41

I want to describe the variables involved in an equation in an itemized environment such that every item begins with the variable name and subsequently comes the description for it. I'd like to have all the descriptions left aligned.

Here is a MWE that of course does not produce what I am looking for.

\documentclass{standalone}
\begin{document}
$E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$.
%
where,
%
\begin{itemize}
    \item $x$      \quad is a continuous random variable.
    \item $f_X(x)$ \quad is the PDF of $x$.
    \item $g(x)$   \quad is a function of $x$.
\end{itemize}
\end{document}
4
  • usepackage{enumitem} and \begin{itemize}[align=left] and then \item[$x$]{is a continuous random variable.}?
    – Adam Liter
    Commented Nov 30, 2013 at 8:59
  • @Adam, That doesn't seem to work right for me. Did you try and it worked?
    – Ali
    Commented Nov 30, 2013 at 9:05
  • Ah, sorry. I think I understand what you want now. Do you still want the bullet points to be there?
    – Adam Liter
    Commented Nov 30, 2013 at 9:11
  • No worries. Yes, I do want the bullets as well =)
    – Ali
    Commented Nov 30, 2013 at 9:21

4 Answers 4

63

What about this

\documentclass{article}
\begin{document}
$E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$.
%
where,
%
\begin{itemize}
    \item{\makebox[2cm]{$x$\hfill} is a continuous random variable.}
    \item{\makebox[2cm]{$f_X(x)$\hfill} is the PDF of $x$.}
    \item{\makebox[2cm]{$g(x)$\hfill} is a function of $x$.}
\end{itemize}
\end{document} 

Output

enter image description here

You can avoid using \hfill for each item if you specify the second optional argument of \makebox to be the letter l (for left):

\documentclass{article}
\begin{document}
$E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$.
%
where,
%
\begin{itemize}
    \item{\makebox[2cm][l]{$x$} is a continuous random variable.}
    \item{\makebox[2cm][l]{$f_X(x)$} is the PDF of $x$.}
    \item{\makebox[2cm][l]{$g(x)$} is a function of $x$.}
\end{itemize}
\end{document} 
2
  • 4
    I think this \makebox is an excellent solution as it will work for lists that go onto the next page. Commented Nov 23, 2015 at 17:44
  • 1
    @karlkoeller \makebox[2cm][1] doesn't work in beamer.
    – alhelal
    Commented Feb 25, 2018 at 7:08
18

Using a tabular as in @PrzemysławScherwentke's answer is a good way to go.

If you still wish to use itemize, here are two options, one without bullets and one with bullets.

\documentclass{article}

\begin{document}
$E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$.
%
where,

% Without bullets
\begin{itemize}
    \item[$x$]{is a continuous random variable.}
    \item[$f_X(x)$]{is the PDF of $x$.}
    \item[$g(x)$]{is a function of $x$.}
\end{itemize}

% With bullets
\begin{itemize}
    \item{$x$\hphantom{$g(x)f_X(x)$} is a continuous random variable.}
    \item{$f_X(x)$\hphantom{$xg(x)$} is the PDF of $x$.}
    \item{$g(x)$\hphantom{$xf_X(x)$} is a function of $x$.}
\end{itemize}

\end{document}

enter image description here

The answer without bullets makes use of the optional argument of \item, which just gives the list item a label. The answer with bullets makes use of \hphantom{} to ensure that the amount of horizontal space taken up in each line is the same as in the other lines.

2
  • This seems like a great option as it will work for list that span over a page. Commented Nov 23, 2015 at 17:42
  • The first solution without the bullets is very simple and works great but if you have some wider symbols they can extend beyond the left edge of the text.
    – mab0189
    Commented May 9 at 13:23
16

I hope that itemize is only a suggestion. A simple solution without it.

\documentclass{article}
\begin{document}
$E[g(x)] = \int_{-\infty}^{+\infty} f_X(x) \, g(x) \, \mathrm{d}x$.
%
where

\begin{tabular}{@{$\bullet$ }ll}
   $x$      & is a continuous random variable.\\
   $f_X(x)$ & is the PDF of $x$.\\
   $g(x)$   & is a function of $x$.
\end{tabular}
\end{document}

enter image description here

2
  • Thanks, Przemysław. Actually, I am using this within the beamer class. I have a lot of macros customizing my lists. So, I'd rather have it defined in the itemize environment.
    – Ali
    Commented Nov 30, 2013 at 9:21
  • One can also use \labelitem instead of directly putting \bullet.
    – koppor
    Commented Jul 10, 2016 at 14:49
10

To emphasize the connection between the main formula and the three explanatory lines, I'd place them all in an align* environment. No real need to clutter up the picture with text bullets.

enter image description here

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\E}{E} % define the expectation operator symbol
\begin{document}
\begin{align*}
\E[g(x)] &= \int_{-\infty}^{+\infty} f_X(x) g(x) \, \mathrm{d}x\\
\shortintertext{where}
x      &\ \text{is a continuous random variable,}\\
f_X(x) &\ \text{is the pdf of $x$, and}\\
g(x)   &\ \text{is a function of $x$.}
\end{align*}
\end{document}

If more space is desired between the variables and the explanatory text, one could replace &\ with &\quad.


Second proposed solution, incorporating information that this is part of a beamer document:

enter image description here

\documentclass{beamer}
\usepackage{amsmath}
\DeclareMathOperator{\E}{E}
\begin{document}
\begin{frame}
$\begin{array}{l@{}l}
\E[g(x)]&{}= \int_{-\infty}^{+\infty} f_X(x) g(x)\, \textnormal{d}x, \text{ where}\\[0.75ex]
x      &\text{is a continuous random variable,}\\
f_X(x) &\text{is the pdf of $x$, and}\\
g(x)   &\text{is a function of $x$.}
\end{array}$
\end{frame}
\end{document}

Observe that because the main text font is not a "roman"/serif font, it's better to use \mathnormal than \mathrm to set the "differential operator" symbol d in upright shape.

2
  • Thanks, Mico. I am explaining this in a beamer frame and that is why I want it itemized.
    – Ali
    Commented Nov 30, 2013 at 9:27
  • @Ali - I've provided a second solution, which incorporates the information that you're preparing a beamer presentation. I still don't think it's necessary to provide "bullet points".
    – Mico
    Commented Nov 30, 2013 at 9:52

You must log in to answer this question.

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