3

I'm writing a document (bridge system notes, if that helps anybody visualize what I'm looking for) and need to make extensive use of nested lists. Here's a minimal example of what I'm using now:

\documentclass{article}

\usepackage[utf8]{inputenc} 
\usepackage{enumitem}

\def\labelitemi{} %%%% these definitions remove bullets and adjust the spacing between nestings
\def\labelitemii{\qquad\thinspace}
\def\labelitemiii{\qquad\thinspace}
\def\labelitemiv{\qquad\thinspace}
\def\labelitemv{\qquad\thinspace}

\newcommand{\bid}[2]{\item \texttt{#1\ \ \ \ \ }#2} %%%% this is used to create each item of the lists
%%%% the monotype font is used to ensure consistent horizontal spacing

\newenvironment{bidding} %%%% this adjusts spacing as I desire
    {\begin{itemize}[leftmargin=*] \itemsep2pt \parskip0pt \parsep0pt}
    {\end{itemize}} 

\begin{document}

\begin{bidding}
\bid{2D}{11-15, 3-suited, short D}
 \begin{bidding}
  \bid{2D}{to play}
   \begin{bidding}
    \bid{2D}{4=3=1=5 shape}
    \bid{P\ }{else}
   \end{bidding}
  \bid{2S}{to play}
  \bid{2N}{strong ask, mostly GF}
   \begin{bidding}
    \bid{3C}{any minimum}
     \begin{bidding}
      \bid{3D}{asks, opener shows a 4-card major or 3NT with both}
     \end{bidding}
    \bid{3D}{4=4=1=4, maximum}
   \end{bidding}
  \bid{3C}{to play}
 \end{bidding}
\end{bidding}
\end{document}

This mostly looks and works great, but I'm having three problems.

First, the built-in LaTeX nesting limit still applies, and I want to be able to nest at least two levels beyond that. I've looked at a couple of solutions on this website, but couldn't see how to adapt those answers to also fit my additional needs.

Second, if the second part of the \bid item is too long, it will wrap around, but since \bid just takes both inputs and puts them in one line with some space in the middle, the new line will start below the first input, and I would like it to start below the start of the second input on the original line.

In other words, I would like these items to look like

2H    lots of text lots of text lots of text lots of text lots of text 
      lots of text lots of text lots of text

but instead they look like

2H    lots of text lots of text lots of text lots of text lots of text 
lots of text lots of text lots of text.

A third and less pressing problem is that in order to achieve the horizontal spacing when the first input of \bid varies, I often have to either pad the first input or insert negative horizontal space. I rarely have to adjust by more than one character width, but it would be nice if there's an easier solution, and this document is several dozen pages long so the padding adds up.

Either further modifications to the environment and commands I've made or an entirely new solution would be great.

  • Use enumitem. Can do everything you want. Decent documentation. Not too complex, but flexible & powerful. – cfr Aug 20 '17 at 3:01
  • Oh, I see you are using it but not really using it. Why not? Seems very strange. – cfr Aug 20 '17 at 3:03
  • You need a line which goes to a second line, if that's part of the problem! – cfr Aug 20 '17 at 3:38
  • Please consider changing your user name :-). – cfr Aug 20 '17 at 4:07
  • As suggested by another tex.stackexchange question, I had used enumitem in another document several months ago to achieve my desired spacing, so I just copied that code over into this new document. I hadn't realized the package could help resolve my further demands for this project! – C H Aug 29 '17 at 3:37
3

Don't insult packages by loading them and then mucking around with LaTeX's innards when they've taken great pains to tidy those smelly entrails away. They'll get all upset and think you don't understand them.

Instead, use enumitem if you load it. Or don't. Either way. For my money, I'd use it, but some people seem to enjoy the pain. It has good documentation. See, especially, the pictures on page 5.

You don't need \bid to take 2 arguments. Just 1 for the label. Even this isn't needed. It would be clearer in some ways to just use \item. But there's a case for \bid, so \let\bid\item should do the job.

This specifies up to 10 nesting levels in the usual way. Increase or decrease as required. It is better not to create many more levels than you need for capacity reasons.

Make the width of the labels standard and you shouldn't need to worry about fiddling with spacing adjustments (or \ \ \ \ which won't always give you the same amount of space and is horrible anyway).

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{enumitem,kantlipsum}
\newcommand\bid{}
\let\bid\item
\newlist{bidding}{itemize}{10}
\setlist[bidding]{label={}, leftmargin=\parindent, align=left, labelindent=0pt, itemsep=2pt, itemindent=0pt, font=\ttfamily, labelwidth=\parindent, labelsep=0pt}
\begin{document}

\begin{bidding}
  \bid[2D]11-15, 3-suited, short D
  \begin{bidding}
    \bid[2D]to play
    \begin{bidding}
      \bid[2D]4=3=1=5 shape
      \bid[P]else
    \end{bidding}
    \bid[2S]to play
    \bid[2N]strong ask, mostly GF
    \begin{bidding}
      \bid[3C]any minimum
      \begin{bidding}
        \bid[3D]asks, opener shows a 4-card major or 3NT with both \kant[1]
      \end{bidding}
      \bid[3D]4=4=1=4, maximum
    \end{bidding}
    \bid[3C]to play
  \end{bidding}
\end{bidding}
\end{document}

bids and bidding

  • Thank you, this works great! I adjusted both leftmargin and labelwidth to 2.5\parident to get the spacing I wanted. However, I'm still having two smaller issues. First, the vertical spacing between nested lists is bigger than I'd like (the vertical space between consecutive items in the same level in a nesting is fine.) Also, if I have a label \bid[something] with nothing else on that line, immediately followed by another nested list, the first item of the nested list appears on the same line as that label. This can easily be alleviated by adding a \ , but is there something easier? – C H Aug 29 '17 at 3:32
  • @CH Maybe Mico's solution with description works better? – cfr Aug 29 '17 at 4:19
1

I think you should use the enumitem package to create a custom description environment.

enter image description here

\documentclass{article}
\usepackage{enumitem}
\newlist{bidding}{description}{10}
\setlist[bidding]{font=\ttfamily}

\begin{document}

\begin{bidding}
\item[2D] 11--15 HCPs, 3-suited, short \texttt{D}
  \begin{bidding}
  \item[2D] to play
    \begin{bidding}
    \item[2D] 4=3=1=5 shape
    \item[P\ ] else
  \end{bidding}
  \item[2S] to play
  \item[2N] strong ask, mostly GF
    \begin{bidding}
    \item[3C] any minimum
      \begin{bidding}
      \item[3D] asks, opener shows a 4-card major or \texttt{3NT} with both majors
      \end{bidding}
    \item[3D] 4=4=1=4 shape, maximum
    \end{bidding}
  \item[3C] to play 
  \end{bidding}
\end{bidding}
\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.