Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am currently generating PDF's with variable contents from a template I made. Data is fetched from a database and used to create reports. This has been working greatly until recently I needed to change the layout.

In a series of traditional description environments I set an item containing a certain score achieved. For example \item[1/2]. After this a subsubsection* will serve as title, followed by a paragraph of simple text.

The problem occurs when the database has no text to insert in the subsubsection* body. I receive the well known "perhaps a missing \item" error.

Is there any way around this?

*EDIT: Below is functioning code. Haha, guess the \noindent is vestigial code from when the titles were still set as sidetags (not sure if mattered there either to be honest).

I need a markup that will print the headings and score even if there is no text to put in the body of that specific list environment.

Suggestions for a complete new solution are very welcome.. would not want LaTeX to remain in a state of error waiting to happen.

\documentclass[11pt, a4paper]{article}

% DOCUMENT LAYOUT
\usepackage{geometry,fancyhdr,tikz,everypage}
\geometry{a4paper, right=2cm, textheight=22cm, marginparsep=0.5cm, marginparwidth=3.5cm, left=2cm, footskip=3.5cm}
\definecolor{AltisLight}{HTML}{B9BAD6}
\definecolor{AltisDark}{HTML}{05266D}
\definecolor{AltisBlue}{HTML}{1E2060}
\definecolor{IngBlue}{HTML}{162D66}
\definecolor{IngOrange}{HTML}{F25C19}

\fancyhf{}
\fancyhfoffset[L]{1cm}
\lhead{\nouppercase{\leftmark}}
\rhead{}
\lfoot{\textcolor{IngOrange}{For internal use only}}
\cfoot{\thepage}
\pagestyle{fancy}

% FONTS
\usepackage{fontspec,xunicode,xltxtra}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont [Ligatures={Common}, Numbers={Lining}]{Linux Libertine O}

% ---- MARGIN LABELS
\usepackage{marginnote}
\newcommand{\sidetag}[1]{\noindent{\parindent=0pt\marginnote{\scriptsize #1}}}
\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{-3.5cm}
\reversemarginpar

% HEADINGS
\usepackage{sectsty}
\usepackage[normalem]{ulem}
\sectionfont{\mdseries\upshape\Large}
\subsectionfont{\mdseries\scshape\normalsize}
\subsubsectionfont{\mdseries\upshape\small}

% BULLET LISTS
\usepackage{enumitem}
\setitemize{topsep=0pt,partopsep=0pt,parsep=0pt,itemsep=0pt}
\setdescription{topsep=0pt,partopsep=0pt,parsep=0pt,itemsep=0pt,labelwidth=1cm}

% DOCUMENT
\begin{document}
\clearpage\phantomsection\addcontentsline{toc}{section}{Robeco}\markboth{Robeco}{Robeco}%
\begin{tikzpicture}[remember picture,overlay]\node [xshift=-3cm, yshift=-5cm, scale=5]at (current page.north east) {None};\end{tikzpicture}
\section*{Score Card}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Fund name}Robeco

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Analyst}LB

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Period}2013 Q1

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Last update}20130305

\end{description}\section*{Governance - Corporate}\noindent\begin{description}\item[1/2]\subsubsection*{Vivamus interdum}

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\end{description}\begin{description}\item[2/2]\subsubsection*{Donec volutpat consequat}

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\end{description}\begin{description}\item[2/2]\subsubsection*{ velit nec mollis dapibus}

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\end{description}\begin{description}\item[1/2]\subsubsection*{Etiam sit amet facilisis dui.}

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\end{description}
\end{document}
share|improve this question
    
Why??? Have you got \noindent before \begin{description} and why have you got a sectioning command inside a list environment. Both of those are going to put LaTeX into a state which is just an error waiting to happen. Perhaps you could describe the intended use so someone could suggest some more reasonable markup? –  David Carlisle Mar 22 '13 at 13:47
    
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document} –  David Carlisle Mar 22 '13 at 13:48
    
Thanks, the working code is now provided. Any help is very appreciated! –  anaheim Mar 22 '13 at 15:28

1 Answer 1

up vote 3 down vote accepted

It was a bit hard to guess the intention (and I didn't have all the fonts) but it seems that the main body is a list of headings. LaTeX has two ways to mark up such things, as a single list of items each introduced with \item or as a list of section headings marked with subsection etc. Your example has a mix of the two.

This suggests one possible layout as a slightly modified description list, where the label always comes on its own line. I removed the text in one item.

enter image description here

\documentclass[11pt, a4paper]{article}

% DOCUMENT LAYOUT
\usepackage{geometry,fancyhdr,tikz,everypage}
\geometry{a4paper, right=2cm, textheight=22cm, marginparsep=0.5cm, marginparwidth=3.5cm, left=2cm, footskip=3.5cm}
\definecolor{AltisLight}{HTML}{B9BAD6}
\definecolor{AltisDark}{HTML}{05266D}
\definecolor{AltisBlue}{HTML}{1E2060}
\definecolor{IngBlue}{HTML}{162D66}
\definecolor{IngOrange}{HTML}{F25C19}

\fancyhf{}
\fancyhfoffset[L]{1cm}
\lhead{\nouppercase{\leftmark}}
\rhead{}
\lfoot{\textcolor{IngOrange}{For internal use only}}
\cfoot{\thepage}
\pagestyle{fancy}

% FONTS
\usepackage{fontspec,xunicode,xltxtra}
%\defaultfontfeatures{Mapping=tex-text}
%\setromanfont [Ligatures={Common}, Numbers={Lining}]{Linux Libertine O}

% ---- MARGIN LABELS
\usepackage{marginnote}
\newcommand{\sidetag}[1]{\noindent{\parindent=0pt\marginnote{\scriptsize #1}}}
\renewcommand*{\raggedleftmarginnote}{}
\setlength{\marginparsep}{-3.5cm}
\reversemarginpar

% HEADINGS
\usepackage{sectsty}
\usepackage[normalem]{ulem}
\sectionfont{\mdseries\upshape\Large}
\subsectionfont{\mdseries\scshape\normalsize}
\subsubsectionfont{\mdseries\upshape\small}

% BULLET LISTS
\usepackage{enumitem}
\setitemize{topsep=0pt,partopsep=0pt,parsep=0pt,itemsep=0pt}
\setdescription{topsep=0pt,partopsep=0pt,parsep=0pt,itemsep=0pt,labelwidth=1cm}
\makeatletter

\newenvironment{adescription}
               {\list{}{\itemindent\z@
                        \itemsep\bigskipamount
                        \let\makelabel\adescriptionlabel}}
               {\endlist}
\newcommand*\adescriptionlabel[1]{%
                                \makebox[\dimexpr\linewidth+\labelwidth\relax][l]{\normalfont\bfseries #1}}

\makeatother
% DOCUMENT
\begin{document}
\clearpage%\phantomsection
\addcontentsline{toc}{section}{Robeco}\markboth{Robeco}{Robeco}%
\begin{tikzpicture}[remember picture,overlay]\node [xshift=-3cm, yshift=-5cm, scale=5]at (current page.north east) {None};\end{tikzpicture}
\section*{Score Card}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Fund name}Robeco

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Analyst}LB

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Period}2013 Q1

\end{description}\begin{description}[leftmargin=2.4cm]\item[]\sidetag{Last update}20130305

\end{description}


\section*{Governance - Corporate}

\begin{adescription}

\item[1/2 Vivamus interdum]

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\item[2/2 Donec volutpat consequat]

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\item[2/2  velit nec mollis dapibus]

% nothing here

\item[1/2 Etiam sit amet facilisis dui.]

 Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 Nullam ultrices mollis posuere. Vivamus interdum, velit nec mollis dapibus,
 mauris turpis posuere velit, aliquam porttitor felis dolor sed lorem.
 Vivamus ac lectus ut sapien sodales lacinia. Praesent eleifend erat vel
 mi placerat sit amet gravida ligula cursus. Donec volutpat consequat est
 eu consequat. Etiam sit amet facilisis dui. Ut tempus laoreet sodales.

\end{adescription}
\end{document}
share|improve this answer
    
Cheers! Seems very much that I have complicated my life for no reason. I'd like to upvote your answer but I cannot. Anyhow it solved my problem! –  anaheim Mar 22 '13 at 16:24
    
@user27293 I think if you are a new user the system makes you wait a bit before accepting/upvoting. –  David Carlisle Mar 22 '13 at 16:25
    
Yeah, It says I need 15 reputation. –  anaheim Mar 22 '13 at 16:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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