[Tex/LaTex] I’m using the standalone package. How to get regular paragraph breaks

line-breakingparagraphspreviewstandalone

I'm using the standalone class to render images for individual math problems that will be displayed in an app, so the cropping functionality is essential. However, the package seems to destroy paragraph breaks support. What I'd like to have is non-indented paragraphs with about 1 line of space between each paragraph, like:

\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex}

I've tried the above and a million other things, including using the preview option, the preview package directly, and messing with the varwidth setting, but nothing seems to work. I'm not very knowledgeable about the inner workings of LaTeX or the packages I'm using, so I'm at a dead end.

Could someone with better knowledge explain to me a.) why this refuses to work b.) if there's some way to get normal paragraph breaks working without workarounds like \\[7pt]? Here is what I'm working with right now:

\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}

Best Answer

Move the

\setlength{\parindent}{10pt}
\setlength{\parskip}{3ex plus 0.5ex minus 0.2ex}

to the first line after \begin{minipage} to avoid minipage overrides them.

\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}

enter image description here

Related Question