2

My document is a list of entries. Here is an example with three entries: enter image description here

All entries have a title and two subtitles. These are followed by text, bullet points or a combination of the two. Note that I would like a big gap between different entries and a smaller one between the subtitles and the rest of each entry.

I have defined a \newcommand called \NewEntry to specify the information that goes into each entry:

\newcommand{\NewEntry}[4]{
{\setlength{\parskip}{20pt}
    #1 \\
    #2 - #3 \\[3pt]}
    #4 \par
}

Calling this command with the code presented at the end, leads to the following output:

enter image description here

This is satisfactory, apart from the space between the subtitles and the first bullet item in the third entry, which is too big. I asked how to solve this in a previous question, without providing the general context. From the answers, it was clear that the extra space is a result of combining \itemize (which starts at a new line by default) with the \\ in my \NewEntry code. Also, some answers explicitely said or implied that there may be a better way to structure my document and suggested that I provide the context, which is what I have tried to do here.

I am looking forward to suggestions about the best way to deal with this problem (including structural changes).

A MWE follows:

\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}
\setlength{\parindent}{0pt}

\newcommand{\NewEntry}[4]{
{\setlength{\parskip}{20pt}
    #1 \\
    #2 - #3 \\[3pt]}
    #4 \par
}

\begin{document}

\NewEntry{TITLE}{SUBTITLE 1}{SUBTITLE 2}
{\lipsum[13]}

\NewEntry{TITLE}{SUBTITLE 1}{SUBTITLE 2}
{Some Text
\begin{itemize}[nosep]
\item First Item
\item Second Item
\end{itemize}
}

\NewEntry{TITLE}{SUBTITLE 1}{SUBTITLE 2}
{\begin{itemize}[nosep]
 \item First Item
 \item Second Item
 \end{itemize}
}

\end{document}
  • End of line is a space. Comment it out if you don't want the space. But ending a line with \\ is almost always wrong outside e.g. tabular and array environments. Why aren't you using \section, \subsection etc.? What's wrong with the space between the subtitles exactly? – cfr Sep 30 '15 at 23:00
  • (Expanding on cfr's first sentence.) Spaces are often significant in macro definitions. Your definition of \NewEntry contains three 'explicit' instructions to TeX that you want it to add space: after [4]{, after {20pt}, and after [3pt]}. You might want to read this question and its answers. – jon Oct 1 '15 at 2:15
3

Something like this?

entries

It is a bit hard to say how best to structure it without more context. Why, for example, are you not using \section*{} and \subsection*{} or similar?

Assuming you do not want to do that for some reason, the following code produces the output above using a \NewEntryX{}{}{}{} command and a new unordered list, entries:

\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem,xparse}
\newlist{entries}{itemize}{1}
\setlist[entries]{label=\textbullet,nosep,topsep=.5em}
\NewDocumentCommand \NewEntryX { m m m m }{%
  {\setlength\parindent{0pt}%
  \vskip 20pt plus 1ex minus .5ex
  \par
  \MakeUppercase{#1}\par
  \MakeUppercase{#2 --- #3}\vskip .5em plus .1em minus .05em\par
  #4}\par}


\begin{document}

  \NewEntryX{Title}{Subtitle 1}{Subtitle 2}
  {\lipsum[13]}

  \NewEntryX{Title}{Subtitle 1}{Subtitle 2}
  {Some Text
    \begin{entries}
      \item First Item
      \item Second Item
    \end{entries}}

  \NewEntryX{Title}{Subtitle 1}{Subtitle 2}
  {\begin{entries}
      \item First Item
      \item Second Item
    \end{entries}}

\end{document}

Note that as much formatting as possible is done in the macro definition e.g. you enter the headings with normal titling capitalisation and the command uppercases them. This makes it a lot easier if you change your mind and want them to be bold, say, or small-caps later.

  • 1
    A group is necessary to confine the setting of \parindent – egreg Sep 30 '15 at 23:31

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.