3

I want to left align equations just as the items in the left.

I used the following code but it only align items not equations

\begin{enumerate}[align=left]
\item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
\item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
\item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
\item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{enumerate}

<code>I want to left align equations just as the items in the left</code>

4
  • I would rather use an align environment for this
    – user31729
    Commented Jul 3, 2015 at 10:20
  • Welcome to TeX.SX! Can you please add some context around that enumerate environment?
    – egreg
    Commented Jul 3, 2015 at 10:33
  • \widetilde looks better, in my point of view
    – user31729
    Commented Jul 3, 2015 at 10:35
  • Yet another possibility is to use a tabular environment, or maybe even tabbing.
    – GuM
    Commented Jul 3, 2015 at 10:55

5 Answers 5

3

Not precisely what the O.P. requested, but I suggest to use an alignat environment rather.

\documentclass{article}

\usepackage{mathtools}
\begin{document}

\begin{alignat}{4}
&\text{Charmness}   &\quad &  C          &\quad\equiv  \phantom{-}N_{c}  &\equiv \quad \phantom{-[} N(c)-N(\bar{c})\phantom{]} \\
&\text{Strangeness} &\quad &  S          &\quad\equiv   -N_s             &\equiv \quad -[N(s)-N(\bar{s})] \\
&\text{Bottomness}  &\quad &  \widetilde{B}  &\quad\equiv  \phantom{-}  N_b  &\equiv \quad -[N(b)-N(\bar{b})] \\
&\text{Topness}     &\quad &  T          &\quad\equiv  \phantom{-}  N_t  &\equiv \quad \phantom{-[} N(t)-N(\bar{t})\phantom{]}  
\end{alignat}


\begin{alignat*}{4}
&\text{Charmness}   &\quad &  C          &\quad\equiv  \phantom{-}N_{c}  &\equiv \quad \phantom{-[} N(c)-N(\bar{c})\phantom{]} \\
&\text{Strangeness} &\quad &  S          &\quad\equiv   -N_s             &\equiv \quad -[N(s)-N(\bar{s})] \\
&\text{Bottomness}  &\quad &  \widetilde{B}  &\quad\equiv  \phantom{-}  N_b  &\equiv \quad -[N(b)-N(\bar{b})] \\
&\text{Topness}     &\quad &  T          &\quad\equiv  \phantom{-}  N_t  &\equiv \quad \phantom{-[} N(t)-N(\bar{t})\phantom{]}  
\end{alignat*}


\end{document}

enter image description here

0
7

I doubt too that a list is the correct environment, but if some reason you really want it, I would do it like this:

\documentclass{article}

\usepackage{enumitem,calc}
\begin{document}
\begin{description}[font=\normalfont,labelwidth=\widthof{Strangeness~},leftmargin=!]
\item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
\item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
\item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
\item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{description}
\end{document}

enter image description here

2
  • Nice idea with widthof!
    – user31729
    Commented Jul 3, 2015 at 10:41
  • @ChristianHupfer I would prefer if widest would work in description too. But as I didn't want to misuse an enumerate to fake a description .... Commented Jul 3, 2015 at 11:01
5

I was about to post this other possibility

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[align=left, leftmargin=*, widest=Strangeness]
\item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
\item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
\item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
\item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{enumerate}

\end{document}

when Ulrike Fischer posted her answer. But maybe it is still of interest.

Here is the output: is actually “strangeness” the widest label? (This question shows a drawback of this method.)

Output of code

1
  • Another nice idea
    – user31729
    Commented Jul 3, 2015 at 10:46
1

With a two-pass approach one can avoid guessing at the widest label:

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}

\newcounter{tabdesc}
\newlength\tabdescwd
\newenvironment{tabdesc}
 {\setlength{\tabdescwd}{0pt}\stepcounter{tabdesc}\let\item\tabdescitem
  \description[labelwidth=\thistabdescwd,font=\normalfont,leftmargin=!]}
 {\writethistabdescwd\enddescription}

\makeatletter
\let\saved@item\item
\def\tabdescitem[#1]{%
  \sbox\z@{\normalfont #1}%
  \ifdim\wd\z@>\tabdescwd\setlength{\tabdescwd}{\wd\z@}\fi
  \saved@item[#1]%
}
\def\writethistabdescwd{%
  \immediate\write\@auxout{%
    \gdef
    \expandafter\string\csname tabdesc@\romannumeral\value{tabdesc}\endcsname
    {\the\tabdescwd}%
  }%
}
\def\thistabdescwd{%
  \@ifundefined{tabdesc@\romannumeral\value{tabdesc}}{4em}{%
    \csname tabdesc@\romannumeral\value{tabdesc}\endcsname}%
}
\makeatother

\begin{document}

\lipsum*[2]
\begin{tabdesc}
\item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
\item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
\item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
\item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{tabdesc}
\lipsum[3]

\end{document}

enter image description here

I wouldn't try and aligning all the \equiv symbols.

10
  • Do you even need to go though the .aux? I'd just run the env twice in order to measure up the items widths and then typeset it normally on the second run.
    – daleif
    Commented Jul 3, 2015 at 12:05
  • @daleif This avoids problems with \label and similar things. It's easier and safer.
    – egreg
    Commented Jul 3, 2015 at 12:11
  • Well, it is complicated to understand.
    – daleif
    Commented Jul 3, 2015 at 12:14
  • Why \romannumeral\value{tabdesc} and not just \roman{tabdesc}? (BTW, I was sure you would volunteer for such a refinement… ;-)
    – GuM
    Commented Jul 3, 2015 at 17:59
  • @GustavoMezzetti Try that when \usepackage[greek]{babel} is loaded. ;-)
    – egreg
    Commented Jul 3, 2015 at 18:02
1

A very simple solution with enumitem:

\documentclass{article}

\usepackage{enumitem}
\usepackage[showframe]{geometry}

\begin{document}

\begin{enumerate}[wide=0pt, widest=Strangeness, leftmargin=*]
  \item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
  \item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
  \item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
  \item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{enumerate}
\vskip1cm

\begin{enumerate}[wide, widest=Strangeness, leftmargin=*]
  \item[Charm] $C\equiv N_c\equiv N(c)-N(\bar{c})$
  \item[Strangeness] $S\equiv -N_s\equiv -[N(s)-N(\bar{s})]$
  \item[Bottomness] $\tilde{B}\equiv N_b\equiv -[N(b)-N(\bar{b})]$
  \item[Topness] $T\equiv N_t\equiv N(t)-N(\bar{t})$
\end{enumerate}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .