3

I have a series of equations with following parameter description. Some of those descriptions are relatively long, meaning that I nead a line break. I use so far table, and to accomodate the long lines I use tabularx

\begin{tabularx}{\textwidth}{@{}lX}
where: & $a$ -- long text long text long text long text long text long text long text long text ,\\
 & $b$ -- long text long text long text long text long text long text long text long text ,\\
 & $c$ -- text,\\
 & $d$ -- text, and\\
 & $e$ -- text.
\end{tabularx}

As the list is relatively long and there are several such equations with list, this leads to ugly spacing between parameters. I would therefore like to allow page breakes within the table. I found the possibility of using ltxtable and longtable, but don't really understand how it would need to be implemented. Is a table even the best solution or are there other and better option where I can have long descriptions and long lists with page breaks?

  • It's a list so you could use a list not a table, then it will break over the page – David Carlisle Sep 27 '13 at 10:31
  • you mean like \begin{description}[noitemsep,nolistsep] \item a -- basfas \item b -- asfasf \end{descriptions} but then for long lines the second line is indented and how to put the "where" on the first line? – Tanja Sep 27 '13 at 10:47
  • Yes but latex lists have many parameters that can control the layout, see the enumitem package, (I don't have time for a full answer today as I'm in a meeting, but someone could provide one:-) – David Carlisle Sep 27 '13 at 12:06
  • I see that a similar problem was posed in this question. However I think most of them (?) will have the problem of no page break. – Tanja Sep 30 '13 at 6:48
  • Yes the question there is essentially a duplicate I suppose I should move my answer there and then close this. Of the answers there the ones based on ams alignments or tabbing will (or can) break over a page (\allowdisplaybreaks for ams alignments) however a list is more flexible and I claim conceptually the right thing – David Carlisle Sep 30 '13 at 7:22
6

Something like this, but modify parameters to suit (or use the enumitem interface)

enter image description here

\documentclass{article}
\setlength\textwidth{10cm}

\newenvironment{plist}{%
\list{}{\labelwidth0pt
\def\makelabel##1{\makebox[2cm][r]{##1 -- }}%
\itemsep 0pt
\advance\leftmargin2cm
\itemindent-2cm
}}
{\endlist}

\begin{document}

\noindent X\dotfill X
\begin{plist}
\item[where\hfill $a$]
long text long text long text long text long text long text long text long text,
long text long text long text long text long text long text long text long text,
\item[$b$]long text long text long text long text long text long text long text long text,
\item[$c$]text,
\item[$d$]text, and
\item[$e$]text.
\end{plist}

\end{document}

or

enter image description here

\documentclass{article}
\setlength\textwidth{10cm}

\newenvironment{plist}{%
\list{}{\labelwidth0pt
\def\makelabel##1{\makebox[1.5cm][r]{##1}}%
\parsep 0pt
\itemsep 0pt
\advance\leftmargin1.5cm
\itemindent-1.5cm
}}
{\endlist}

\begin{document}

\noindent X\dotfill X
\begin{plist}
\item[where\hfill $a$]--
long text long text long text long text long text long text long text long text,
long text long text long text long text long text long text long text long text,
\item[$b$]-- long text long text long text long text long text long text long text long text,
\item[$c$]-- text,
\item[$d$]-- text, and
\item[$e$]-- text.
\item[$C_{ox}$]${}=23$nF -- gate capacitance,
\item[$\mu$]-- mobility in the semiconductor [cm$^2$/Vs], and
\item[$V_{g,th}$]-- threshold voltage.
\end{plist}

\end{document}

or (one last time:-) another variant (in this one I made the indent an optional parameter to the environment, defaulting to 1.5cmand as requested set where flush left.):

enter image description here

\documentclass{article}
\setlength\textwidth{10cm}

\newenvironment{plist}[1][1.5cm]{%
\list{}{
\def\makelabel##1{##1\hfill}%
\parsep 0pt
\itemsep 0pt
\labelsep0pt
\labelwidth#1\relax
\leftmargin\labelwidth
\itemindent0pt
}}
{\endlist}

\begin{document}

\noindent X\dotfill X
\begin{plist}
\item[where] $a$ --
long text long text long text long text long text long text long text long text,
long text long text long text long text long text long text long text long text,
\item $b$ -- long text long text long text long text long text long text long text long text,
\item $c$ -- text,
\item $d$ -- text, and
\item $e$ -- text.
\item $C_{ox}=23$nF -- gate capacitance,
\item $\mu$ -- mobility in the semiconductor [cm$^2$/Vs], and
\item $V_{g,th}$ -- threshold voltage.
\end{plist}

\end{document}
  • This goes in the right direction. However I don't like the large spacing between items. I should just be normal spacing as in text. I have some times longer items where I put e.g. $a$=1213424 units which would mean that I would have to implement a larger indent. Also it would look then a bit shaky on the left. I care more about alignement for $a$, $b$ etc than of the definitions – Tanja Sep 27 '13 at 18:04
  • the vertical separation between items is of course setable in the list definition (\parsep 0pt probably does what you want there) as for the long items you would need to give more complete example, the original code use a tabular l so everything would indent to the widest here you would have to manually adjust the 2cm as written but you could set that to set it from the widest entry (as \bibitem` does) – David Carlisle Sep 27 '13 at 18:12
  • I have for example \begin{tabular}{@{}ll} where: & $C_{ox}=23$nF -- gate capacitance,\ & $\mu$ -- mobility in the semiconductor [cm$^2$/Vs], and\ & $V_{g,th}$ -- threshold voltage.\\end{tabular} – Tanja Sep 27 '13 at 18:21
  • @user2758804 added 2nd version perhaps closer to what you mean but basically you can adjust the list parameters in lots of ways... – David Carlisle Sep 29 '13 at 0:14
  • So what if I just take \item[where] $a$ -- asjfalsjf \item $b$ -- asdfasd but then how to align the "where" to the left, as for a text (no indent)? Changing the makelabel to \def\makelabel##1{\makebox[1.5cm][l]{##1}}% seems not sufficient – Tanja Sep 29 '13 at 11:33

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.