我正在使用独立类来渲染将在应用程序中显示的单个数学问题的图像,因此裁剪功能必不可少。但是,该包似乎破坏了段落分隔支持。我想要的是非缩进段落,每个段落之间大约有 1 行空格,例如:
\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}
我尝试了上述方法和其他无数方法,包括使用预览选项、直接使用预览包以及调整 varwidth 设置,但似乎都不起作用。我对 LaTeX 的内部工作原理或我使用的包不太了解,所以我走投无路。
有谁比我更了解吗?a.) 为什么这不起作用 b.) 是否有某种方法可以让正常的段落分隔符正常工作而无需像这样的变通方法\\[7pt]
?以下是我现在正在处理的内容:
\documentclass[border=1bp]{standalone}
\usepackage[document]{ragged2e}
\usepackage[none]{hyphenat}
\usepackage{amsmath}
\begin{document}
\begin{minipage}{4in}
This is a paragraph. It's a nice long paragraph.
This is another paragraph.
This is a paragraph. It's a nice long paragraph. This is a paragraph. It's a nice long paragraph.
\end{minipage}
\end{document}
答案1
移动
\setlength{\parindent}{10pt}
\setlength{\parskip}{3ex plus 0.5ex minus 0.2ex}
到第一行之后\begin{minipage}
以避免minipage
覆盖它们。
\documentclass[preview,border=1bp]{standalone}
\begin{document}
\begin{minipage}{4in}
\setlength{\parindent}{10pt}
\setlength{\parskip}{3ex plus 0.5ex minus 0.2ex}
This is a paragraph. It's a nice long paragraph.
This is another paragraph.
This is a paragraph. It's a nice long paragraph. This is a paragraph. It's a nice long paragraph.
\end{minipage}
\end{document}
答案2
您可以使用该varwidth
选项,加上调整以施加非零 parskip:
\documentclass[border=1bp,varwidth]{standalone}
\usepackage[document]{ragged2e}
\usepackage[none]{hyphenat}
\usepackage{amsmath}
\setlength{\textwidth}{4in} % decide what's best for you
\makeatletter
\g@addto@macro{\@parboxrestore}{\setlength{\parskip}{\baselineskip}}
\makeatother
\begin{document}
This is a paragraph. It's a nice long paragraph.
This is another paragraph.
This is a paragraph. It's a nice long paragraph.
This is a paragraph. It's a nice long paragraph.
\end{document}