6

My code looks horrendous

When monochromatic light is shone through a solution of iron, Beer's law states that 

$$ A = \varepsilon l c $$
\begin{tabular}{l}
      Where $A$ is amount of light absorbed \\
      \quad \quad  \quad $\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
      \quad \quad  \quad but not with concentration\\
      \quad  \quad \quad $l$ is the thickness of the sample

\end{tabular}

enter image description here

Can it be improved?

  • Welcome to TeX.SX! There are many improvements possible, for example not using $$...$$ and a description list, for example – user31729 Nov 9 '14 at 8:27
6

Please have a look on Why is \[ ... \] preferable to $$ ... $$?, the description of the variables can be done in description or in an itemize list, for example.

From a personal point of view, I would rather use \ell instead of l as equation identifier.

\documentclass{article}

\usepackage{mathtools}

\begin{document}
When monochromatic light is shone through a solution of iron, Beer's law states that 

\[ A = \varepsilon l c \]

\noindent where
\begin{description}
\item  $A$ is amount of light absorbed 
\item  $\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
  but not with concentration
\item  $l$ is the thickness of the sample
\end{description}


\end{document}

enter image description here

Another (better?) solution, with more fine control of the list parameters, better optical appealance, but this is a matter of taste actually.

\documentclass{article}

\usepackage{enumitem}
\usepackage{mathtools}

\begin{document}
When monochromatic light is shone through a solution of iron, Beer's law states that 

\[ A = \varepsilon \ell c \]

\noindent where
\begin{description}
\item $A$   is amount of light absorbed 
\item  $\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
  but not with concentration
\item  $\ell$ is the thickness of the sample
\end{description}


\noindent where
\begin{description}[labelindent=10pt,labelsep=10pt]
\item[$A$]   is amount of light absorbed 
\item[$\varepsilon$] is the molar absorbance coefficient, which varies with wavelength,\\
  but not with concentration
\item[$\ell$] is the thickness of the sample
\end{description}

\end{document}

enter image description here

| improve this answer | |
  • Thanks for your reply, it works for me. What font did you use? it looks nicer than \usepackage{mathpazo} – Jack Nov 9 '14 at 8:38
  • Since I did not use any other package apart from mathtools I would assume it's the standard font, CM math in the ams version? – user31729 Nov 9 '14 at 8:39
  • 1
    If for no other reason than to avoid attracting @egreg's lightning bolt and zap, you shouldn't leave blank lines before and after the displayed equation. Syntactically speaking, the displayed equation is part of the paragraph; don't have TeX insert unnecessary (and typographically speaking inferior) paragraph breaks. – Mico Nov 9 '14 at 9:22
3

Another alternative is to use a (d)cases environment:

enter image description here

Here's the code:

\documentclass{article}
\usepackage{mathtools}
\begin{document}

  When monochromatic light is shone through a solution of iron, Beer's law states that
  \[ A = \varepsilon l c ,\quad
    \text{where }\quad
    \begin{dcases*}
        A& is amount of light absorbed \\
        \varepsilon& is the molar absorbance coefficient, which varies \\
                   & with wavelength but not with concentration\\
        l& is the thickness of the sample
  \end{dcases*}
  \]

\end{document}

Of course, you could ust use an ordinary cases environment but I prefer dcases from the mathtools package.

| improve this answer | |
  • 2
    Typographically speaking, a shortcoming of this solution is that all interline distances to the right of the large curly brace are the same. This isn't quite right because lines 2 and 3 belong together; hence, their interline distance should be slightly smaller than that between lines 1&2 and lines 3&4. – Mico Nov 9 '14 at 9:00
  • @Mico Would it be easy to remove the space between the second and third line? – Jack Nov 9 '14 at 9:08
  • 1
    @jack - The cleanest way to remove the space would be to use a \parbox construct, as I do in my answer. – Mico Nov 9 '14 at 9:13
1

Two tricky examples (your code at the beginning):

\documentclass{article}
\begin{document}

When monochromatic light is shone through a solution of iron, Beer's law states that 

$$ A = \varepsilon l c $$
\begin{tabular}{l}
      Where $A$ is amount of light absorbed \\
      \quad \quad  \quad $\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
      \quad \quad  \quad but not with concentration\\
      \quad  \quad \quad $l$ is the thickness of the sample
\end{tabular}

\bigskip

When monochromatic light is shone through a solution of iron, Beer's law states that 
\[
 A = \varepsilon l c 
\]
 Where $A$ is amount of light absorbed 

\noindent\hangindent3em\hangafter0
      $\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
     but not with concentration\\
       $l$ is the thickness of the sample



When monochromatic light is shone through a solution of iron, Beer's law states that 
\[
 A = \varepsilon l c 
\]
Where $A$ is amount of light absorbed \\
 \hspace*{3em}%     
\begin{tabular}{l}
$\varepsilon$ is the molar absorbance coefficient, which varies with wavelength,\\
       but not with concentration\\
       $l$ is the thickness of the sample
\end{tabular}

\end{document}

enter image description here

| improve this answer | |
1

Here's another solution, which uses an align* environment. Its virtue, so to speak, is that the left-hand edges of the main equation and of the description lines are aligned. Two reasons for using a \parbox for the description of \varepsilon: (i) no need to select a line break by hand, and (ii) the interline spacing inside the parbox won't be as wide as across the other lines of the align* environment. The only choice that needs to be made is the width of the parbox -- I happened to select 3in, but you should feel free to adjust this to suit your needs.

enter image description here

\documentclass{article}
\usepackage{mathtools,ragged2e}

\begin{document}
When monochromatic light is shone through a solution of iron, Beer's law states that 
\begin{align*}
A &= \varepsilon l c
\shortintertext{where}
A &\text{ is the amount of light absorbed,}\\
\varepsilon &\text{ \parbox[t]{3in}{\RaggedRight is the molar absorbance coefficient, which 
   varies with wavelength but not with concentration, and}}\\
l &\text{ is the thickness of the sample.}
\end{align*}

\end{document}
| improve this answer | |
0

I'm not sure if this helps but this is how usually I do what yo asks:

\documentclass{article}    
\usepackage{amsmath}    

\begin{document}
When monochromatic light is shone through a solution of iron, Beer's law states that:

\begin{equation*} % The starred version avoid the automatic number.
 A = \varepsilon l c
 \end{equation*} 

\noindent Where:\\ 
$A$ is amount of light absorbed, \\
$\varepsilon$ is the molar absorbance coefficient, which varies with wavelength, but not with concentration, and\\
$l$ is the thickness of the sample.
\end{document}

enter image description here

I use amsmathfor use the starred version of equation environment that produces the same than equation but the number of the equation. I don't use the tabular environment, and the alignment is very simple. It works for you?

| improve this answer | |
  • 2
    never leave a blank line before a displayed equation (it produces an empty paragraph that looks like vertical space but does not work correctly at page breaks) similarly it would be better not to have the blank line after, then you would not need \noindent – David Carlisle Nov 9 '14 at 12:00
  • @DavidCarlisle Thanks for that suggestion, I'll take it in account. – Aradnix Nov 9 '14 at 23:32

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.