15

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

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

  • Kinda off topic, but what do you use to capture your images? – azetina Nov 13 '13 at 18:48
  • @azetina: It is a top secret. – kiss my armpit Nov 13 '13 at 18:49
  • 1
    That's it?! I want to get you a beer. – Chen Lin Nov 13 '13 at 19:02
8

You can use the varwidth option, plus an adjustment to impose a nonzero 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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.