들여쓰기(서식)

Indentation (typesetting)


많은 언어의 서면 형식에서 들여쓰기 또는 들여쓰기는 새로운 단락의 시작을 알리는 행의 시작 부분에 있는 빈 공간입니다.많은 컴퓨터 언어들이 프로그램에서 "문단" 또는 다른 논리 블록을 지정하기 위해 이 기술을 채택했습니다.

예를 들어, 다음 행은 1~6개의 공백을 사용하여 들여씁니다.

이 단락은 한 칸 들여쓰기로 되어 있다.

이 단락은 세 칸으로 들여쓰기되어 있다.

이 단락은 6칸 들여쓰기로 되어 있다

컴퓨터 프로그래밍에서, outdent, unindentdedent라는 신조어는 들여쓰기 프로세스의 반전을 묘사하기 위해 사용되며, 페이지 여백(또는 이전, 더 작은 들여쓰기 수준)으로 텍스트를 재정렬한다.

오른쪽에서 왼쪽으로의 언어(: 히브리어 및 아랍어)에서도 들여쓰기는 동일하게 사용되지만, 행이 시작되는 종이의 오른쪽 여백부터 사용합니다.

조판에서의 들여쓰기

페이지 치수를 나타내는 테두리와 관련하여 아래 그림과 같이 크게 세 가지 유형의 들여쓰기가 있습니다.

A first-line indentation indents only the first line of each paragraph.
2em의 첫 줄 들여쓰기:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporary ut dolore magna aliqua.Ut enim ad minim veniam, quis nostroud 운동 Ullamco laboris ut aliquip ea commodo 결과.Duis aute Irure dolor in reputerit in voluptate velit ese cillum dolore eu fugiat nulla pariatular.예외적으로 신트 오카에캣 큐피다트 비프로젝트, culpa qui officia deserunt mollit id est laborum.
A hanging indentation indents the remaining lines of each paragraph while leaving the first line of each paragraph in place.
2em의 매달린 움푹 패인 부분:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporary ut dolore magna aliqua.Ut enim ad minim veniam, quis nostroud 운동 Ullamco laboris ut aliquip ea commodo 결과.Duis aute Irure dolor in reputerit in voluptate velit ese cillum dolore eu fugiat nulla pariatular.예외적으로 신트 오카에캣 큐피다트 비프로젝트, culpa qui officia deserunt mollit id est laborum.
A block indentation indents the entire block of text.
왼쪽에 2em 블록 들여쓰기:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporary ut dolore magna aliqua.Ut enim ad minim veniam, quis nostroud 운동 Ullamco laboris ut aliquip ea commodo 결과.Duis aute Irure dolor in reputerit in voluptate velit ese cillum dolore eu fugiat nulla pariatular.예외적으로 신트 오카에캣 큐피다트 비프로젝트, culpa qui officia deserunt mollit id est laborum.
블록 따옴표에는 일반적으로 양쪽에서 들여쓰기가 사용됩니다.여기에서는 왼쪽과 오른쪽에 2em이 표시되어 있습니다(텍스트의 정렬이 정당화되지 않은 경우 단어 래핑에 따라 일부 행의 경우 오른쪽에 더 많을 수 있습니다).
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporary ut dolore magna aliqua.Ut enim ad minim veniam, quis nostroud 운동 Ullamco laboris ut aliquip ea commodo 결과.Duis aute Irure dolor in reputerit in voluptate velit ese cillum dolore eu fugiat nulla pariatular.예외적으로 신트 오카에캣 큐피다트 비프로젝트, culpa qui officia deserunt mollit id est laborum.
블록 인용의 정당화된 텍스트의 예로서 양쪽에서 3em씩 블록으로 둘러싸여 있습니다.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod temporary ut dolore magna aliqua.Ut enim ad minim veniam, quis nostroud 운동 Ullamco laboris ut aliquip ea commodo 결과.Duis aute Irure dolor in reputerit in voluptate velit ese cillum dolore eu fugiat nulla pariatular.예외적으로 신트 오카에캣 큐피다트 비프로젝트, culpa qui officia deserunt mollit id est laborum.

프로그래밍에서의 들여쓰기

컴퓨터 프로그래밍 언어에서 들여쓰기는 가독성을 향상시키기 위해 프로그램 소스 코드를 포맷하는 데 사용됩니다.들여쓰기는 일반적으로 프로그래머에게만 사용됩니다.컴파일러인터프리터는 프로그래밍 문 사이에 공백이 얼마나 있는지 거의 신경 쓰지 않습니다.그러나 일부 프로그래밍 언어에서는 프로그래밍 구조를 구분하기 위해 들여쓰기를 사용하며, 오프사이드 규칙의 변형을 사용하는 경우가 많습니다.Haskell, Occam, Python, MoonScript Ya 프로그래밍 언어는 이러한 방식으로 들여쓰기에 의존합니다.

들여쓰기 장소, 공간 또는 탭 사용 여부, 그리고 얼마나 많은 공간을 사용해야 하는지에 대한 의견은 프로그래머들 사이에서 종종 뜨거운 논쟁을 일으키며 일부는 들여쓰기 논쟁을 종교전쟁[1]비슷하다고 묘사한다.2006년에 탄성 탭스톱이라고 불리는 세 번째 들여쓰기 방법이 제안되었다.

문장의 일반적인 들여쓰기 외에 다른 괄호 들여쓰기 스타일이 일반적으로 사용됩니다.

언어 들여쓰기 메모
배쉬 다르다 Fritz Mehner의 스타일[2] 가이드에서는 2, 4, 또는 8개의 공간을 제안하며 모든 예제에 2개를 사용합니다.구글[3]2개의 공간을 사용합니다.
C 다르다 Linux 커널은 1개[4][5]탭을 사용합니다.NASA는 4개의 [6]공간을 사용합니다.클린턴 스테리는 3개의 [7]공간을 지지한다.
C++ 다르다 WebKit는 4개의 [8]공간을 권장합니다.구글은 [9]2개의 공간을 사용합니다.
C# 4공간 Microsoft 의 C# 코딩 [10]규약에 준거.
CSS 다르다 Drupal, GitHub, Google은 [11][12][13][14]2개의 공간을 사용합니다.WordPress[15]탭을 사용합니다.
다트 dart format는 2개의 공간을 사용합니다.
델파이 스페이스 2개 RAD [citation needed]Studio 디폴트입니다.
F# 4공간 F# 스타일 [16]가이드와 같습니다.
가세요 탭 1개 'Effective Go'[17]에 따라.
하스켈 다르다 구글은 [18]2개의 공간을 사용합니다.
HTML 다르다 구글은 [13]2개의 공간을 사용합니다.HTML Tidy는 기본적으로 두 칸입니다.[19]
자바 다르다 Oracle[20]4개의 공간을 사용합니다.안드로이드[21]4개의 공간을 사용합니다.대부분의 Eclipse IDE 구성 요소는 탭을 사용합니다.
자바스크립트 다르다 더글라스 크록포드는 4개의 [22]공간을 지지한다.GitHub과 Google은 [23][24]2개의 공간을 사용합니다.jQuery[25]탭을 사용합니다.Firefox의 내장 js뷰티파이어는 기본적으로 2개의 공백으로 되어 있습니다.구글 크롬과 인터넷 익스플로러에 내장프리티프린터는 4개의 공간을 사용합니다.
줄리아. 4공간 줄리아 스타일 가이드.[26]
코틀린 4공간 퍼 코틀린 스타일 가이드.[27]
루아 스페이스 2개 Per Lua 스타일 [28]가이드.
다르다 "Perlstyle: Perl style guide"는 래리 월이 4개의 [29]공간을 선호하지만 필수는 아니라고 말합니다.
PHP 다르다 드루팔[30]2개의 공간을 사용합니다.PEAR 및 Zend는 [31][32]4개의 공간을 사용합니다.CodeIgniter 및 WordPress는 [33][34]탭을 사용합니다.PSR-2는 4개의 [35]공간을 지정합니다.
PowerShell 다르다 비공식 PowerShell 베스트 프랙티스 [36]및 스타일 가이드의 네 칸.
파이썬 4공간 PEP-8마다.[37] (1개의 탭이 사용되는 경우도 있지만 4개의 공간이 선호됩니다.)
루비 스페이스 2개 루비별 스타일 [38]가이드
4공간 녹별 스타일 가이드.[39]
스칼라 스페이스 2개 Scala 스타일 [40]가이드 기준.
재빠르다 다르다 구글은 [41]2개의 공간을 사용합니다.
TCL 4공간 TCL 스타일 가이드 기준.[42]
비주얼 베이직 4공간 Microsoft 의 비주얼 베이직 코딩 [43]규약에 준거하고 있습니다.
XML 다르다 구글은 [44]2개의 공간을 사용합니다.

레퍼런스

  1. ^ "Tabs versus Spaces: An Eternal Holy War". Jwz.org. 5 January 2007. Retrieved 18 January 2014.
  2. ^ "Bash Style Guide and Coding Standard" (PDF). Lug.fh-swf.de.
  3. ^ "Archived copy". Archived from the original on 26 June 2014. Retrieved 23 June 2014.{{cite web}}: CS1 maint: 제목으로 아카이브된 복사(링크)
  4. ^ "Archived copy". Archived from the original on 14 February 2015. Retrieved 15 February 2015.{{cite web}}: CS1 maint: 제목으로 아카이브된 복사(링크)
  5. ^ "Linux kernel coding style". Archived from the original on 11 June 2022. Retrieved 21 July 2022.
  6. ^ "C STYLE GUIDE". NASA Technical Reports Server. August 1994.
  7. ^ Staley, Clinton (2006). "C Program Style Rules". Cal Poly Department of Computer Science & Software Engineering.{{cite web}}: CS1 maint :url-status (링크)
  8. ^ "Code Style Guidelines". WebKit. 7 November 2015. Retrieved 31 December 2021.
  9. ^ [1] 2014-10-06년 Wayback Machine에 보관
  10. ^ Bill Wagner. "C# Coding Conventions (C# Programming Guide)". Msdn.microsoft.com. Retrieved 3 September 2017.
  11. ^ "CSS formatting guidelines". Drupal.org. 14 January 2013. Retrieved 18 January 2014.
  12. ^ "CSS · Styleguide · GitHub". Github.com. Retrieved 18 January 2014.
  13. ^ a b "Google HTML/CSS Style Guide". Google GitHub. Indentation. Archived from the original on 13 March 2016. Retrieved 13 March 2016. Indent by 2 spaces at a time. 이것은 공식 버전의 HTML 렌더링 복사본으로, XML 형식으로 유지됩니다.
  14. ^ "styleguide: Style guides for Google-originated open-source projects". Github.com. 3 September 2017. Retrieved 3 September 2017.
  15. ^ "WordPress › CSS Coding Standards « Make WordPress Core". Make.wordpress.org. 17 July 2012. Retrieved 20 July 2018.
  16. ^ "F# code formatting guidelines". docs.microsoft.com. Retrieved 14 October 2020.
  17. ^ "Effective Go – The Go Programming Language". golang.org. Retrieved 3 September 2017.
  18. ^ "HaskellStyleGuide – ganeti – Style Guide for the Haskell code – Cluster-based virtualization management software – Google Project Hosting". Code.google.com. 8 January 2014. Archived from the original on 27 June 2013. Retrieved 18 January 2014.
  19. ^ "HTML Tidy Configuration Options Quick Reference". Tidy.sourceforge.net. 18 June 2008. Retrieved 18 January 2014.
  20. ^ "Code Conventions for the Java Programming Language: 4. Indentation". Oracle.com. Retrieved 18 January 2014.
  21. ^ "Code Style Guidelines for Contributors Android Developers". Source.android.com. Retrieved 18 January 2014.
  22. ^ "Code Conventions for the JavaScript Programming Language". Javascript.crockford.com. 13 November 2006. Retrieved 18 January 2014.
  23. ^ "JavaScript 路 Styleguide". Github.com. Archived from the original on 15 August 2013. Retrieved 18 January 2014.
  24. ^ "JaveScript Style Rules". Google-styleguide.googlecode.com. Archived from the original on 16 February 2014. Retrieved 18 February 2014.
  25. ^ jQuery Foundation - jquery.org. "JavaScript Style Guide Contribute to jQuery". Contribute.jquery.org. Retrieved 18 January 2014.
  26. ^ "Style Guide · The Julia Language". docs.julialang.org.
  27. ^ "Coding Conventions – Kotlin Programming Language". Kotlin.
  28. ^ "lua-users wiki: Lua Style Guide". lua-users.org. Retrieved 3 September 2017.
  29. ^ Allen, Jon (JJ) (ed.). "perlstyle: Perl style guide". Perl 5 Version 32.1 Documentation. Perl Foundation. Retrieved 19 April 2021.
  30. ^ "Coding standards". Drupal.org. Retrieved 18 January 2014.
  31. ^ "Manual :: Indenting and Line Length". Pear.php.net. Retrieved 18 January 2014.
  32. ^ "PHP Coding Standard (draft) – Contributors – Zend Framework Wiki". Framework.zend.com. Archived from the original on 3 January 2008. Retrieved 18 January 2014.
  33. ^ "Style Guide : CodeIgniter User Guide". Ellislab.com. Retrieved 18 January 2014.
  34. ^ "WordPress › PHP Coding Standards « Make WordPress Core". Make.wordpress.org. 23 July 2012. Retrieved 18 January 2014.
  35. ^ "PHP : Coding Style Guide". Php-fig.org. Archived from the original on 15 March 2014. Retrieved 18 February 2014.
  36. ^ "Code Layout and Formatting – PowerShell Practice and Style". PowerShell Practice and Style. Retrieved 17 October 2021.
  37. ^ "PEP 8 – Style Guide for Python Code". Python.org. Retrieved 3 September 2017.
  38. ^ Batsov, Bozhidar (3 September 2017). "ruby-style-guide: A community-driven Ruby coding style guide". Github.com. Retrieved 3 September 2017.
  39. ^ "rust: A safe, concurrent, practical language". Github.com. 3 September 2017. Retrieved 3 September 2017.
  40. ^ "Indentation – Scala Documentation". docs.scala-lang.org. Retrieved 3 September 2017.
  41. ^ "Swift Style Guide". google.github.io. Retrieved 17 October 2021.
  42. ^ Ray Johnson. "Tcl Style Guide" (PDF). Tcl.tk. Retrieved 3 September 2017.
  43. ^ "Structured Coding Conventions". msdn.microsoft.com. Retrieved 3 September 2017.
  44. ^ "Google XML Document Format Style Guide". google.github.io. Google. Retrieved 17 October 2021.