2

So, I have a definition which takes in data like this:

...{apple\\orange\\cat\\imperial green tea\\left-handed president}...

In the document I get the following after compilation:

apple

orange

cat

imperial green tea

left-handed president


However, the line spacing is too large for my taste. I'd like to adjust it to be a bit smaller. How can I do this?

1

Try the package setspace.

\documentclass{article}
\usepackage{setspace}

\begin{document}

text\\at\\normal\\spacing

\begin{spacing}{.8}
apple\\orange\\cat\\imperial green tea\\left-handed president
\end{spacing}

text\\at\\normal\\spacing

\end{document}

Changing the .8 to 1 gives single-spaced lines, 2 gives double-spaced lines, etc.

1

Depending on your particular use case, you might want to consider using a list type structure, which allows you to

  1. Remove the vertical spacing:

    enter image description here

  2. Have some vertical spacing:

    enter image description here

  3. And also number the items if desired:

    enter image description here

Notes:

  • The showframe package was used just to show the page margins. It is not needed in your actual use case.

Code:

\documentclass{article}
\usepackage{pgffor}
\usepackage{enumitem}
\usepackage{showframe}

\newcommand{\MyList}{apple, orange, cat, imperial green tea, left-handed president}

\begin{document}

You can have them listed:
\medskip
\begin{enumerate}[nosep, label={}, leftmargin=0pt]
    \foreach \x in \MyList {\item \x}
\end{enumerate}

\bigskip
Or you can have them numbered, and adjust the vertical spacing:
\medskip
\begin{enumerate}[nosep, label={}, leftmargin=0pt, itemsep=5pt]
    \foreach \x in \MyList {\item \x}
\end{enumerate}

\bigskip
Or you can have them numbered:
\medskip
\begin{enumerate}[nosep,itemsep=5pt]
    \foreach \x in \MyList {\item \x}
\end{enumerate}

\end{document}

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.