4

I don't use LaTeX that much, so I'm really clumsy with this stuff.

I've being searching for what I needed but since it appears there're no examples (or maybe I'm just bad at this) I decided to ask here.

I'm using some code that was giving to me in class, but I want to modify the way the itemize is looking.

enter image description here

\documentclass[final,letterpaper,twocolumn,authoryear,11pt]{elsarticle}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage{enumitem}

\begin{document}
Donde,
\begin{itemize}  
\itemsep=0ex \itemindent=1cm 
\item[$K^B_A$:]  Constante de equilibrio químico, adim.
\item[$m_{A,liquid}$:] Concentración de A en la solución, mol/m\textsuperscript{3}.
\end{itemize}
\end{document}

I would like m_{A,liquid} to start just underneath K^B_A with the same spacing and, if it is possible, to make mol/m^3 move just underneath "Concentración".

Hope you could understand my question and help me!

  • 1
    Welcome to LaTeX! Welcome to TeX.SX!. I don't seem to have the same spacing. Can you please expand your example, to a minimal working example (MWE) – Moriambar Apr 14 '17 at 20:32
  • 1
    Sorry beginner's mistake, my bad \documentclass[final,letterpaper,twocolumn,authoryear,11pt]{elsarticle} and I was trying this \usepackage{enumitem} – Eli Apr 14 '17 at 20:37
  • try and edit your own post, please, and include that there too. – Moriambar Apr 14 '17 at 20:48
  • Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Moriambar Apr 14 '17 at 20:49
  • Think the edit work, I just try it in a blank space. Sorry the inconvenience. – Eli Apr 14 '17 at 20:54
4

Like this, with enumitem and enumerate?

\documentclass[final, letterpaper, twocolumn, authoryear, 11pt]{elsarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,margin=2.5cm, showframe}
\usepackage{amsmath}
\usepackage{enumitem}

\begin{document}

Donde,
\begin{enumerate}[wide, itemsep=0pt, leftmargin =*,widest={$m_{A,\mathrm{liquid}}$}]
  \item[$K^B_A$:] Constante de equilibrio químico, adim.
  \item[$m_{A,\text{liquid}}$:] Concentración de A en la solución, mol/m\textsuperscript{3}.
\end{enumerate}

\end{document} 

enter image description here

  • 1
    Shouldn't you be using \text instead of \mathrm? – Moriambar Apr 14 '17 at 21:23
  • Maybe. I'm not sure whether it changes the inter-letter spacing. – Bernard Apr 14 '17 at 21:27
  • Actually, question here, why did you guys change $m_{A,liquid}$ for $m_{A,\text{liquid}}$ or $m_{A,\mathrm{liquid}}$? just for aesthetics? @Bernard your answer work perfect, it all resumes in the way I wrote the equation that was above, because I need the nomenclature to match – Eli Apr 14 '17 at 22:47
  • liquid alone is typed as the succession of variables l,i,q,u,i,d (with the inter-letter spacing for variables), not as a word, and in italic. If for some reason, you absolutely want it to be italic, you can us \textit{liquid}. – Bernard Apr 14 '17 at 22:57
5

I think a table is more suitable for you:

\documentclass[final,letterpaper,twocolumn,authoryear,11pt]{elsarticle}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.5cm}
\usepackage[spanish]{babel}
\usepackage{enumitem}
\usepackage{siunitx}
\usepackage{tabularx}

\begin{document}


\begin{tabularx}{\columnwidth}{@{}>{$}c<{$}X@{}}
K^B_A&Constante de equilibrio químico, adim.\\
m_{A,\mathrm{liquid}}&Concentración de A en la solución \si{mol/m^{3}}\\
\end{tabularx}

\end{document}

Produces

enter image description here


Recommendations

I would recommend

  1. making the environment into a float, i.e. surrounding the tabularx with \begin{table} ... \end{table}

  2. Abbreviate liquid to liq.

  3. Read some resource for learning basic LaTeX (browse around the most voted questions)


NOTES AND USAGES

I would just like to point out:

  • I added spanish babel (I think the language is spanish)

  • I added fontenc and inputenc to support T1 fonts and UTF-8 input encoding

  • I added siunitx to space correctly the unit of measure

  • I added \mathrm{liquid} because you are typesetting in math, and that's how the words come out in roman font and correctly spaced. \text would've produced the same here, but in general uses the text font, thus not always yields the roman font. (Thanks to @barbarabeeton)

  • I added tabularx to have the autoexpanding X column in tables (read the package documentation)

  • 1
    Thanks a lot!! I just change \textwidth to \columnwidt because it suited me better. You have save me some format points in my score :) – Eli Apr 14 '17 at 21:10
  • @Eli Yes, of course. \columnwidth is better, I'll change that – Moriambar Apr 14 '17 at 21:11
  • 2
    actually, \text will follow the current text style, so if you're using it within the scope of a theorem, the result will be italic (but not spaced like a string of variables). if something is always to be upright, then \mathrm is preferable. – barbara beeton Apr 15 '17 at 1:41
1

Two alternatives to enuitem and tabular-like environments:

1) The desclist package:

mwe

\documentclass[twocolumn,12pt]{elsarticle}
\usepackage[utf8]{inputenc}
\usepackage{desclist}
\begin{document}

\begin{desclist}{}{:}[$m_{A,\,liquid}$ ]
\item[$K^B_A$] Constante de equilibrio químico, adim. 
\item[$m_{A,\,liquid}$] Concentración de A en la 
                        solución, mol/m\textsuperscript{3}.
\end{desclist}
\end{document}

2) Just for fun, reinvent the wheel without packages and without lists. Instead of an environment, just a macro with two arguments for each item:

mwe

\documentclass[twocolumn,12pt]{elsarticle}
\usepackage[utf8]{inputenc}
\newlength\anchod
\settowidth{\anchod}{$m_{A,\,liquid}$: }
\def\describe#1#2{{\par\noindent\makebox[\anchod][l]%
{$#1$:}#2\hangindent\anchod\par}}
\begin{document}
\describe{K^B_A}{Constante de equilibrio químico, adim.} 
\describe{m_{A,\,liquid}}{Concentración de A en la 
solución, mol/m\textsuperscript{3}.}
\end{document}

In this case there are no more vertical spaces around each fake item that those of normal paragraphs. If that is not enough, you can change it locally with:

   {\setlength{\parskip}{\itemsep} 
    \describe{...}{...}
    ...  
    \describe{...}{...} 
    Normal paragraph\par}` 

The \itemsep is to mimic the spacing of true lists, but, of course, you can change \itemsep to anything else. Or you can add some spacers like \bigskip in the macro to avoid change the paragraphs skips.

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.