## LaTeX forum ⇒ Text Formatting ⇒ Align Counters and Equations side-by-side

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

### Align Counters and Equations side-by-side

I know that a) is aligned correctly with 5) but how do you align b) with 6) and c) with 7) ? Here is what my document looks like that I'm working on below MWE to get the real idea of what I mean. Below is my MWE.


Below is my real document

Tags:

CDbile
Posts: 19
Joined: Mon Jan 31, 2011 6:48 pm
Well, I can't give you the code, but I can give you some ideas...

If you know TeX a little you know that when it begins to build the second minipage, the first one is only a big box and what is inside is forgotten, so you can't ask TeX to align the right part with the left part this way.

So, what I think you need to do is :
• create a new environment,
• with only one counter,
• that you use to create two "pseudo-lists",
• and that you build from left to right ((a), (5), (b), (6), etc.)

Edit: Oh, and clean your MWE, you don't need anything else than
enumitem
here.
CDbile

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
1. How do I create a pseudo list ?
2. I don't know any Tex at all
3. i don't know the difference between TeX and LaTeX
4. How do I create a counter for a new environment and also why can't I use the standard latex enumerate counter with a created environment instead of having to create one my own?

Also, I don't understand what you mean by counter, do you mean the enumerate label? for example.. a)... b)....c) or 1. ... 2. .... 3. ? Also, how can I have ONE counter representing two lists? To me, it doesn't make much sense

CDbile
Posts: 19
Joined: Mon Jan 31, 2011 6:48 pm
ghostanime2001 wrote:2. I don't know any Tex at all
3. i don't know the difference between TeX and LaTeX

LaTeX is a set of macros defined to simplify document creation in TeX, which is the typesetting language behind. LaTeX can be basically viewed as a layer over TeX.
And, I really think you should know a little about it, because knowing how it works behind greatly simplifies error handling and typesetting your document. Every good LaTeX tutorial tells a few words about TeX (see viewtopic.php?f=44&t=2177)

ghostanime2001 wrote:1. How do I create a pseudo list ?
4. How do I create a counter for a new environment and also why can't I use the standard latex enumerate counter with a created environment instead of having to create one my own?

Also, I don't understand what you mean by counter, do you mean the enumerate label? for example.. a)... b)....c) or 1. ... 2. .... 3. ? Also, how can I have ONE counter representing two lists? To me, it doesn't make much sense

Now, I worked a little on this and have built the first draft of a solution (see below). It's not very customizable for now, so you should work on it or specify what you exactly want to do with this environment.


Note the package calc in the preamble.
CDbile

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
Is % necessary for something?

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
wow that's really close to something that I wanted.. HOWEVER!!!! I made another one like that except my codes is soooo different from yours. Even with all this research into LaTeX and surfing the Whole wide web im still not getting the things really experienced author's talk about.. works like tokens, key values, strings etc... but I really appreciate helping a rookie like me lol. My alternate code is:

\begin{enumerate}[nosep,leftmargin=\labelsep,start=3]\item\begin{enumerate*}[label=\alph*)]\item\begin{minipage}[t]{2.5in}\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{m_{\ce{He2}}}&=\text{4.2 mol}\times\text{4 g/mol} \\ &=\text{16.8 g}\end{aligned}\end{array}\end{minipage}	\item[5)]\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{n_{\ce{Na}}}&=\dfrac{\text{0.115 \cancel{g}}}{\text{23 \cancel{g}/mol}} \\ &=\text{0.005 mol}\end{aligned} \end{array} \\[0.5\baselineskip]\item[b)]\begin{minipage}[t]{2.5in}\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{m_{\ce{Pb}}}&=\text{\num{8.11e-2} mol}\times\text{207.2 g/mol} \\ &=\text{16.8 g}\end{aligned}\end{array}\end{minipage}	\item[6)]\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{n_{\ce{Pb}}}&=\dfrac{\text{\num{2.6e-3} \cancel{g}}}{\text{207.2 \cancel{g}/mol}} \\ &=\text{\num{1.25e-5} mol}\end{aligned}\end{array} \\[0.5\baselineskip]\item[c)]\begin{minipage}[t]{2.5in}\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{n_{\ce{He2}}}&=\dfrac{\text{\num{3.01e22} atoms}}{\text{\num{6.02e23} atoms}} \\ &=\text{0.05 mol}\end{aligned} \\ \\ \begin{aligned}[t]\ce{m_{\ce{He2}}}&=\text{0.05 mol}\times\text{4 g/mol} \\ &=\text{0.2 g}\end{aligned} \end{array}\end{minipage}	\item[7)]\begin{array}[t]{@{}l@{}}\begin{aligned}[t]\ce{n_{\ce{P}}}&=\dfrac{\text{6.2 \cancel{g}}}{\text{31 \cancel{g}/mol}} \\ &=\text{0.2 mol}\end{aligned} \\ \\ \begin{aligned}[t]\ce{N_{\ce{P}}}&=\text{0.2 mol}\times\text{\num{6.02e23} atoms} \\ &=\text{\num{1.2e23} atoms}\end{aligned}\end{array} \par\medskip\end{enumerate*}\end{enumerate}

Also another question, how can I put math environments in your example? for some odd reason I can't put aligned environment

CDbile
Posts: 19
Joined: Mon Jan 31, 2011 6:48 pm
ghostanime2001 wrote:Is % necessary for something?

Here, they're not, sometimes they are when every space is important, so I put them "just in case" when I test things .

ghostanime2001 wrote:wow that's really close to something that I wanted.. HOWEVER!!!! I made another one like that except my codes is soooo different from yours. Even with all this research into LaTeX and surfing the Whole wide web im still not getting the things really experienced author's talk about.. works like tokens, key values, strings etc... but I really appreciate helping a rookie like me lol.

Well, the idea behind your code is basically the same, but as you need to put the item number every time, I think I'll keep my code and change it a little for more customization :


The main change is that I complexified "custenv" a little, it has 5 args now, but they are explained in the code, you will understand it easily (I hope !). With that you'll be able to reuse "custenv" in cases with different numbering.

ghostanime2001 wrote:Also another question, how can I put math environments in your example? for some odd reason I can't put aligned environment

CDbile

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
How can I place a top centered "outer-counter" on this array-like set of equations? For example something like:
3. a) ...... b) (the ... are for empty horizontal space)


CDbile
Posts: 19
Joined: Mon Jan 31, 2011 6:48 pm
In the custenv environment, just add [t] after \tabular :

\tabular[t]{#1}}{\endtabular}
CDbile

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
What about using horizontal length parameters like for example \labelsep, \leftmargin, \labelwidth, align=left,right or widest= ???