我需要删除在 tex 文件中以新行开始插入的空格。例如:
文件.tex:
This is actually a paragraph
that will continue to this new line.
文件.pdf
This is actually a paragraph that will continue to this new line.
^
I would like to remove this space
答案1
答案2
如果您想将其用于长段文本,您可以定义一个简单的开关,使换行符被忽略:
\def\ignorelinebreaks{%
\catcode`\^^M=9
\endlinechar=`\^^M}
然后使用它:
\documentclass{article}
\def\ignorelinebreaks{%
\catcode`\^^M=9
\endlinechar=`\^^M}
\begin{document}
{
\ignorelinebreaks
hello world
world hello
}
\end{document}
您甚至可以利用 LaTeX 的环境:
\documentclass{article}
\def\ignorelinebreaks{%
\catcode`\^^M=9
\endlinechar=`\^^M}
\begin{document}
\begin{ignorelinebreaks}
hello world
world hello
\end{ignorelinebreaks}
\end{document}