如何在独立文档中获取段落分隔符?

如何在独立文档中获取段落分隔符?

我有一堆(1000 多个)独立的 tex-snippet,用于构建文档。我还想能够单独编译它们。这些独立文档的问题是我无法让段落分隔符正常工作。我想在包中设置 parskip。

我从这里尝试了解决方案:https://tex.stackexchange.com/a/144868/103166,但它与 calc-package 冲突,我也需要 calc-package 来处理一些文档。由于我的声誉不够,我无法发表评论,所以我提出了新的问题。

梅威瑟:

\documentclass[varwidth=100mm]{standalone}

%\setlength{\parskip}{\baselineskip} % This doesn't work
\AtBeginDocument{\setlength{\parskip}{\baselineskip}}% % This doesn't work either

\usepackage{calc}
%%This works if calc-package is not loaded but fails when it is.
\makeatletter
%\g@addto@macro{\@parboxrestore}{\setlength{\parskip}{\baselineskip}}
\makeatother

\begin{document}
%\setlength{\parskip}{\baselineskip}% This would work
This here is a paragraph.

There should be a blank line between previous and this paragraph.
\end{document}

答案1

您可以在不使用 \setlength 的情况下设置 \parskip:

\documentclass[varwidth=100mm]{standalone}

\usepackage{calc}
\makeatletter
\g@addto@macro{\@parboxrestore}{\parskip=\baselineskip}
\makeatother

\begin{document}

This here is a paragraph.

There should be a blank line between previous and this paragraph.
\end{document}

相关内容