
여러 줄 이상 을 정의하면 \newcommand
출력에 원치 않는 공백이 생깁니다.
긴 명령을 작성하면서도 추가 공백 없이 읽을 수 있도록 하려면 어떻게 해야 합니까?
나의 현재 해결책은 줄 바꿈 없이 모든 것을 작성하는 것입니다. 그러나 그것은 그다지 지속 가능하지 않습니다.
이 동작의 MWE는 다음과 같습니다.
\documentclass{memoir}
\begin{document}
\newcommand{\lraA}{B}
\newcommand{\lraB}{
%lots of latex logic
%so this command is on multiple lines
B
}
\ \\
A\lraA{}C\\
A\lraB{}C
\end{document}
이는 다음을 생성합니다.
알파벳
알파벳
답변1
새 줄은 공백으로 처리됩니다. 그래서 귀하의 코드에서
\newcommand{\lraB}{ % <-- you are putting a space here!
%lots of latex logic
%so this command is on multiple lines
B % <-- you are putting a space here!
}
허위 공백을 피하려면 주석 문자로 줄을 끝내야 합니다 %
.
\newcommand{\lraB}{% <-- HERE
%lots of latex logic
%so this command is on multiple lines
B% <-- HERE
}