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}
Speravir
  • 19,491
Ali
  • 1,824

4 Answers4

60

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} 
Steven C. Howell
  • 587
  • 1
  • 7
  • 18
karlkoeller
  • 124,410
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.

Adam Liter
  • 12,567
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

Mico
  • 506,678
  • 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 Nov 30 '13 at 09:21
  • One can also use \labelitem instead of directly putting \bullet. – koppor Jul 10 '16 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.

Mico
  • 506,678
  • Thanks, Mico. I am explaining this in a beamer frame and that is why I want it itemized. – Ali Nov 30 '13 at 09: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 Nov 30 '13 at 09:52