0

Related Questions:

I'm having trouble getting all these requirements met at the same time:

  1. Create an enumerated list.
  2. Spread over 2 columns, with latex doing the balancing.
  3. Each column center-aligns its contents (as a whole) wrt to the column's center. e.g. without disrupting the alignment of item labels.

Edit:

Removed previous examples in favor of a partial solution I've found. The output can achieve what I'm after visually, but it hinges on manual tweaking of a parameter in \styleone (1cm in the example), adjusting it by eye is tedious and visually sub-optimal. I'm not sure how to compute it properly though.

enter image description here

\documentclass{article} 
\usepackage{lipsum} 
\usepackage{multicol}
\usepackage{forarray}

\newcommand{\styleone}[2]{\hbox to 1cm{\textbf{#1}}}
\newcommand{\clist}[1]{
    \begin{enumerate}
        \centering
        \setlength{\itemsep}{2pt}%
        \setlength{\parskip}{0cm}%
        \ForEach{;}
        {
            {\item \ \expandafter\styleone\thislevelitem\par}
        }{#1}
    \end{enumerate}
}


\begin{document}

 \lipsum[1]

\medskip

\begin{multicols}{2}
    \raggedcolumns
    \clist{
        {Jake};
        {Jill};
        {John};
        {James};
        {Jillian};
        {Jake};
        {Jill};
        {John};
        {James};
        {Jillian};
        {Jake};
        {Jill};
        {John};
        {James};
        {Jillian}
    }

\end{multicols}

\end{document}
  • 2
    This would be easier to do with a table, I think. – Alan Munn Aug 16 '15 at 2:57
  • I agree with Alan Munn, but I would say, that it doesn't look very nice anyway. – user31729 Aug 16 '15 at 3:09
  • Alan, you're not overlooking auto-numbering and auto-balancing? tell me more. – Jared Kulik Aug 16 '15 at 3:36
  • Why the downvote?? – Jared Kulik Aug 16 '15 at 7:31
  • 2
    Not my downvote (and I have no idea why someone would). But this is a really difficult problem because depending on the longest width of an item, the margins of the column it is in will have to change. But since you want the column splitting to be automatic, there's no good way to measure what the correct width should be. – Alan Munn Aug 16 '15 at 22:13
2

The easiest way would be to use a \makebox with some width specification, here set to 0.85\columnwidth and apply either a wrapper command for each item text, say \forcecenteritem or an automated list loop, doing the centering, using \forcecenteritem too. The later approach requires storing the item content into a list before, this is done with \forcsvlist. (If commas appear in the item content itself, use a {...} to group this content, see the example please.

\documentclass{article}

\usepackage{lipsum}
\usepackage{multicol}

\usepackage{etoolbox}

\listgadd{\mylist}{}

\forcsvlist{\listgadd\mylist}{%
  Jake, Jill,
  John, Janine,
  James, Jake,
  Jill, John,
  Janine, James,
  Jake, Jill,
  John, Janine,
  {%
    James, Jake,
    Jill, John,
    Janine%
  }%
}

\newcommand{\centerthestuff}[1]{%
  \item \forcecenteritem{#1}%
}

\newcommand{\forcecenteritem}[1]{%
  \makebox[0.85\columnwidth]{#1}%
}

\begin{document}

\lipsum[1]

\setlength{\columnseprule}{1pt}
\begin{multicols}{2}
  \begin{enumerate}
    \forlistloop{\centerthestuff}{\mylist}
  \end{enumerate}
\end{multicols}

\begin{multicols}{2}
  \begin{enumerate}
  \item \forcecenteritem{Jake}
  \item \forcecenteritem{Jill}
  \item \forcecenteritem{John}
  \item \forcecenteritem{Janine}
  \item \forcecenteritem{James}
  \item \forcecenteritem{Jake}
  \item \forcecenteritem{Jill}
  \item \forcecenteritem{John}
  \item \forcecenteritem{Janine}
  \item \forcecenteritem{James}
  \item \forcecenteritem{Jake}
  \item \forcecenteritem{Jill}
  \item \forcecenteritem{John}
  \item \forcecenteritem{Janine}
  \item \forcecenteritem{James}
  \end{enumerate}
\end{multicols}
\end{document}

output

  • Thanks, but not what I was looking for. Imagine each column's content is a plain enumerated list set inside a vbox, then center that vbox horizontaly within the column. – Jared Kulik Aug 16 '15 at 3:43
  • @JaredKulik: I think you should restate your question then. My solution does what your title requests: Keeping the labels aligned and centering the content. I'll keep my solution anyway. – user31729 Aug 16 '15 at 3:45
  • Sorry I wasn't clear enough---I've edited my question. – Jared Kulik Aug 16 '15 at 3:47
  • @JaredKulik: It's not clearer and I have no time now to change my 'solution', since I've will be absent for some days – user31729 Aug 16 '15 at 3:51
  • There, that ought to be clear enough. Don't feel obligated :). – Jared Kulik Aug 16 '15 at 4:04

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.