Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Tags
- 고체역학
- Zotero
- JAX
- 우분투
- LaTeX
- 에러기록
- WOX
- Dear abby
- MATLAB
- Julia
- teps
- 논문작성법
- IEEE
- 옵시디언
- 수치해석
- 인공지능
- obsidian
- 수식삽입
- 텝스
- Linear algebra
- ChatGPT
- 생산성
- 텝스공부
- Numerical Analysis
- Statics
- 논문작성
- 딥러닝
- matplotlib
- pytorch
- Python
Archives
- Today
- Total
뛰는 놈 위에 나는 공대생
[LaTeX] 여러 줄 주석처리 본문
LaTeX는 주석처리를 하려면 주석처리하고 싶은 줄을 드래그하고 CTRL+/ 단축키를 통해 %를 추가하여 주석으로 만들 수 있다.
그런데 긴 줄의 코드를 주석처리하고 싶으면 이런 방식이 어려울 것이다. 이 글에서는 여러 줄을 한 보이게 하는 방법에 대해 다룬다.
1. 패키지 comment 또는 verbatim을 통해 comment 블록 생성
내가 찾아본 방법으로 가장 간단한 것은
\usepackage{verbatim}
\begin{comment}
% 주석처리할 내용
\end{comment}
다음과 같이 주석내용을 comment 블럭으로 감싸주는 것이다.
package verbatim도 필요하니 같이 넣어준다.
그런데 verbatim의 경우 문제가 발생할 수도 있다고 한다. 따라서 \usepackage{comment}를 사용해도 괜찮다고 한다.
더 advanced하게 사용하려면
\documentclass{article}
\usepackage{comment}
% uncomment to include stuff in standard comment-environment
%\includecomment{comment}
% define a mysection env which content is excluded
\excludecomment{mysection}
\begin{document}
This text will be displayed
\begin{comment}
This text will only be displayed, if \includecomment{comment} was given
\end{comment}
\begin{mysection}
This text will only be displayed, if \includecomment{mysection} was given
\end{mysection}
\end{document}
위와 같이 comment나 mysection을 document이전에 배제할지, 포함할지를 결정하면 된다.
2. TeX 문법의 \iffalse 사용
\iffalse
I don't want this to happen
\fi
\iffalse로 처리해뒀다가 보이게 하고 싶으면 \iftrue로 바꿔주면 된다고 한다.
참고자료
https://tex.stackexchange.com/questions/87303/multi-line-block-comments-in-latex
https://tex.stackexchange.com/questions/17816/commenting-out-large-sections
'기타 > 논문작성 Writing' 카테고리의 다른 글
[Zotero] citation key 고정 (0) | 2023.04.24 |
---|---|
[논문작성] Biography (예시) (0) | 2023.04.05 |
[LaTeX] Table 만들기 (1) | 2023.03.14 |
[논문작성] Zotero에서 bibtex 내보낼 때 제목형식 바꾸는 방법 (0) | 2023.03.07 |
[서지관리프로그램] ENDNOTE/Mendeley/Zotero (3) | 2023.03.06 |
Comments