3

I'm trying to create a custom description environment (using enumitem) so I can describe the terms of an equation. What I want is to define item labels that are defaulted to inline math mode, and also to horizontally align the list to the right hand side of the items described, as in this example (without the colons):

enter image description here

I'm aware of the solutions given here (in fact, I pulled the image from that post), but I'm required to use enumitem (not using tabular, array, etc.) and the enumitem solution doesn't quite do what I want.

So, how can I define a custom description list like that? I've tried using the package's documentation, but haven't been able to do it.

4

Will this do?

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}

\usepackage{enumitem}
\SetLabelAlign{myright}{\hss\llap{$#1$}}
\newlist{where}{description}{1}
\setlist[where]{labelwidth=2cm,labelsep=1em,
                        leftmargin=!,align=myright,font=\normalfont}

\begin{document}

\[ P_{xi}=\overline{U}_{x}+\sigma_{x}\frac{\sum^{Nu}_{k}D_{kx}\times
    \left( \frac{S_{ki}-\overline{U}_{k}}{\sigma_{k}}\right)}{\sum^{Nu}_{k}D_{kx}} \]
Where:
\begin{where}
    \item [P_{xi}] is the predicted rate for user $x$ on item $i$
    \item [S_{ki}] is the rate of song $i$ given by user $k$
    \item [\overline{U}_{x}] is the average rate of user $x$
    \item [\overline{U}_{k}] is the average rate of user $k$
    \item [\sigma_{x}] is the standard deviation of all the rates of user $x$
\end{where}

\end{document}

enter image description here

2

You can use scrextend and paralist

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{scrextend}
\usepackage{paralist}
\usepackage{enumitem}

\usepackage{blindtext}

\begin{document}

\blindtext

\begin{equation}
  \label{eq:mylabel}
P_{xi}=\overline{U}_x+\sigma_x\frac{\sum_k^{Nu}D_{kx}\times\left(\frac{S_{ki}-\overline{U}_k}{\sigma_k}\right)}{\sum_k^{Nu}D_{kx}},
\end{equation}

Where:

\begin{addmargin}[4em]{1em}
\begin{compactitem}
    \item [$P_{xi}$]: is the predicted rate for user $x$ on item $i$
    \item [$S_{ki}$]: is the rate of song $i$ given by user $k$
    \item [$\overline{U_{x}}$]: is the average rate of user $x$
    \item [$\overline{U_{k}}$]: is the average rate of user $k$
    \item [$\sigma_{x}$]: is the standard deviation of all the rates of user $x$
\end{compactitem}
\end{addmargin}

\blindtext

\end{document}

and this excelent answer about indentation.

enter image description here

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.