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 would like to have the list number at the beginning of the item, and not centered as is the case for item (b) the example below. If I comment out the \usepackage{nccmath}, I get this, but then the spacing gets messed up. I'd rather keep the nccmath package if possible.

I also do need to keep the [c] for the minipages.

I have looked at Preventing itemize environment to insert initial vertical space and Including an itemized list within a tabular column using the paralist package, but can not get that to work for me.

\documentclass{standalone}

\usepackage{standalone}
\usepackage{paralist} 

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes vertical align, but changes spacing

\newcommand{\MyMiniPage}{
\begin{minipage}[c]{1.0in}
  \begin{align*}
    a &= b\\
    c &= d
  \end{align*}
\end{minipage}
\begin{minipage}[c]{1.0in}
  \begin{align*}
    y &= z
  \end{align*}
\end{minipage}
}

\begin{document}
\begin{enumerate}[(a)]
  \item First item
  \item \MyMiniPage
  \item Third item
\end{enumerate}
\end{document}

I attempted to use \compress as mentioned in the other posts above, but was not able to get it to work.

---------------- Revised posting using \input -------------

This is in the file ListsProblem-Minipage.tex:

\documentclass[preview=false]{standalone}

\usepackage{standalone}
\usepackage{amsmath}

\begin{document}
\begin{minipage}[c]{1.0in}
    \begin{align*}
        a &= b\\
        c &= d
    \end{align*}
\end{minipage}
\begin{minipage}[c]{1.0in}
    \begin{align*}
        y &= z
    \end{align*}
\end{minipage}
\end{document}

This is in the file ListsProblem-Minipage2.tex:

\documentclass[preview=false,fleqn]{standalone}

\usepackage{standalone}
\usepackage{amsmath}

\begin{document}
%\begin{minipage}{3.0in}
\begin{align*}
                (-3)^4 &= 81\\
\frac{5^{23}} {5^{21}} &= 25
\end{align*}
%\end{minipage}
\end{document}

And here is the main file:

\documentclass[fleqn]{standalone}

\usepackage{standalone}
\usepackage{paralist} 

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes align, but changes spacing
\begin{document}
\input{ListsProblem-Minipage.tex}  % These two correctly yields
\input{ListsProblem-Minipage.tex}  % the desired 4 columns

\begin{enumerate}[(a)]
    \item First item
    \item \input{ListsProblem-Minipage.tex}
    \item \input{ListsProblem-Minipage2.tex}  % not in a mini-page
    \item Third item
\end{enumerate}
\end{document}

Note that the item label (b) is not aligned with the top of the two center aligned mini pages. The alignment of the (b) with the mini-pages that I want can be seen by commenting out the \usepackage{nccmath}. But I want a solution that does not require me to abandon the nccmath package. Commeting this out also screws up the spacing.

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted
+50

This may be solved with \valign

\newcommand{\MyMiniPage}{%
  \leavevmode\vtop{\hrule height 0pt \kern-\baselineskip
  \valign{\vfill##\vfill\cr
    \hbox to 1in{$\begin{aligned}
    a &= b\\
    c &= d
  \end{aligned}$\hfill}\cr
  \hbox to1in{$\begin{aligned}
    y &= z
  \end{aligned}$\hfill}\cr}}
}

I put everything into a \vtop, where I care to set the first line aligned with the \item; then it's just a "trivial" \valign. :)

--- Added after having seen the example ---

In the case of an included standalone file the approach is different:

\documentclass{standalone}

\usepackage{standalone}
\usepackage{paralist}

\newcommand{\iteminput}[2][\topskip-1bp]{%
  \leavevmode\vtop{\hrule height 0pt\kern-\dimexpr#1\relax
    \input{#2}}}

\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes align, but changes spacing
\begin{document}
\input{ListsProblem-Minipage.tex}  % These two correctly yields
\input{ListsProblem-Minipage.tex}  % the desired 4 columns

\begin{enumerate}[(a)]
    \item First item
    \item \iteminput{ListsProblem-Minipage.tex}
    \item Third item
\end{enumerate}
\end{document}

The command \iteminput has an optional argument in case the default back up in the \vtop is not correct

\iteminput[<dimension>]{filename}
share|improve this answer
    
This produces the output I want. But the two mini pages that I provided in my posting are coming from a standalone file and need to function as mini pages. For example, if I say \MyMiniPage \MyMiniPage I do not get the expected behavior (which I do with the definition of MyMinipage that I gave in the post. –  Peter Grill Apr 21 '11 at 18:49
    
@Peter: please, provide a real example. –  egreg Apr 21 '11 at 19:30
    
Above ex is close to real. To simplify posting, I defined a newcommand{\MyMiniPage}. In reality, contents of this command are in a separate standalone file MyMiniPage.tex, and the enumerate line reads \item \input{MyMiniPage.tex} instead of \item \MyMiniPage. I need the contents of this file to behave as a mini-page (so for instance, 2 subsequent \input{MyMiniPage.tex} gives 4 columns center aligned as the above example does with \MyMiniPage \MyMiniPage. But when MyMiniPage.tex is included in a list, I want the top of the two (center aligned) mini-pages at the top of the list num. –  Peter Grill Apr 21 '11 at 20:10
    
Is it a problem to provide the code for the standalone files? It's impossible to try and give a solution, otherwise. –  egreg Apr 21 '11 at 20:15
    
Standalone files now posted. I left the original code as well in case it is useful to someone else. –  Peter Grill Apr 21 '11 at 20:33
show 5 more comments

If you want it flush left, then simply use $...$ lines of math code

\documentclass{article}

\usepackage{standalone}
\usepackage{paralist} 
\usepackage{mathtools}
\usepackage{nccmath} % Removing fixes vertical align, but changes spacing

\newcommand{\MyMiniPage}{\arraycolsep=1.4pt
$\begin{array}{@{} l l @{\qquad} l l}
    a &= b   & y &=z \\[3pt]
    c &= d
  \end{array}$}

\begin{document}
\begin{enumerate}[(a)]
  \item First item
  \item \MyMiniPage
  \item Third item
\end{enumerate}
\end{document}

enter image description here

share|improve this answer
    
I would like the two minipages to be [c] aligned with each other. I just want the label of the second item (b) to be aligned with the top. Would also prefer to still use the the nccmath package, unless there is a problem with that package. –  Peter Grill Apr 14 '11 at 18:10
    
@Peter: see edited answer –  Herbert Apr 14 '11 at 18:56
    
Ok, guess I am not being very clear: I want the (b) at the top, AND the two mini-pages to be centered with respect to each other. The mini-pages are coming from separate standalone files, but to simply the test case here I defined a command - both show exactly the same problem. They really should remain as mini-pages as they don't always just have math in them. So, I need them to be mini-pages, centered with respect to each other. I just want the label at the top. –  Peter Grill Apr 14 '11 at 19:23
add comment

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.