3

I would like to emulate the vertical spacing of tabular without using tabular. When the \parskip package is used, using \par leaves too much vertical space, so I thought I'd emulate it with use of a \newline:

enter image description here

Now, this seems to work just fine, most of the time. But am running into a Missing number, treated as zero which I suspect is related to using a \newline. Plus I recall something about using a \\ or \newline outside of a tabular or array type of environment being a bad thing.

So, my question is: Is using \\ or \newline a bad thing, and if so, why? What alternative ways can I emulate the vertical spacing of tabular when using the parskip package?

References

Code:

\documentclass{article}
\usepackage{parskip}

\newcommand{\ColumnA}[2][l]{\makebox[2.5em][#1]{#2}}%

\begin{document} Output using \verb|tabular|:

\begin{tabular}{@{}ll} abc & def \ uvw & xyz \ \end{tabular}

Using \verb|\par| leaves additional vertical space:

\ColumnA{abc} def \par \ColumnA{uvw} xyz \par

\medskip Emulating \verb|tabular|:

\ColumnA{abc} def \newline \ColumnA{uvw} xyz \newline

\end{document}

Peter Grill
  • 223,288
  • I'm confused: parskip (more or less) just increases \parskip to put space between paragraphs, if you don't want paragraphs with space between don't use it (or locally set \parskip back to zero? – David Carlisle May 05 '14 at 09:49
  • 1
    I cannot see why the double backslash schouldn't be used in your case?? It is only a problem inside a paragraph with more than one line. –  May 05 '14 at 12:38
  • @DavidCarlisle: I am ok with setting \parskip locally, just thought that that it was recommended int the linked questions to not do that. – Peter Grill May 06 '14 at 04:01
  • @Herbert: Thanks. I will use the double backslash then. – Peter Grill May 06 '14 at 04:01

1 Answers1

1

As mentioned by Herbert you should use \\. It is no bad thing. If you really want to end a line, it is the right thing for you. In most cases it should be also your preferred way of breaking lines, because some environments redefine \\ to suit the current formatting.

If you search for something stretching your text to line end you should have a look at \linebreak.

My suggestion regarding parskip: Forget it. You don't need it. You want content which is not in distinct paragraphs, so linebreaks are sufficient.

TeXnician
  • 33,589