2

This question already has an answer here:

I am using the description environment for a set of definitions. A label that I have is too long to fit in the left margin of the page. I do not know how to force a line break in the item label - nor do I want to. Is there a way to get the description environment to detect when a label is too long and have it break such that that the item label is still right aligned?

Note: My question is different than the question mentioned in the comments because I specifically want the label in the margin, not inside the main body of the page.

\documentclass[12pt, letterpaper, oneside, draft]{memoir}
\usepackage{enumitem}

% itemize environment configuration
\setlist[itemize]{noitemsep, topsep=0pt}

\begin{document}
\begin{description}[align=right]
\item[Rate of Reinforcement] Text that doesn't matter. The label is the same label that I need to use.
\end{description}

\end{document}

Edit (followup): I implemented the solution from the accepted answer, however now I get this. Any idea on why there are now question marks leading the label? weird question marks

marked as duplicate by Alan Munn, CarLaTeX, Stefan Pinnow, Zarko, user31729 Jun 24 '17 at 22:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    It is a duplicate but that solution does not work with this. Try it out. You will see that the text is no longer in the margin and is bunched together. – K. Shores Jun 21 '17 at 2:44
3

I guess you mean something like this. I just put 3cm as label width but you could also retrieve the exact width of the margin from memoir.

\documentclass[12pt, letterpaper, oneside, draft]{memoir}
\usepackage{enumitem}
\usepackage{blindtext}

\SetLabelAlign{parright}{\smash{\parbox[t]{\labelwidth}{\raggedleft#1}}}

\begin{document}

\blindtext

\begin{description}[style=multiline,leftmargin=0pt,labelwidth=3cm,align=parright]
\item[Rate of Reinforcement] Text that doesn't matter. The label is
  the same label that I need to use. Make the line a little longer to
  show that it breaks nicely.
\item[Rate of Reinforcement] Text that doesn't matter. The label is
  the same label that I need to use. Make the line a little longer to
  show that it breaks nicely.
\item[Rate of Reinforcement] Short line to see it fail!
\item[Rate of Reinforcement] Text that doesn't matter. The label is
  the same label that I need to use. Make the line a little longer to
  show that it breaks nicely.
\end{description}

\blindtext

\end{document}

enter image description here

  • Thank you. I am now getting question marks before my item labels, but they are in the right spot. Do you know why this could happen with the information I have already given or do you think it is something more specific with my document (in which case I won't ask any more questions about these question marks on here)? – K. Shores Jun 22 '17 at 3:08
  • @K.Shores You can answer this yourself. Do question marks show up in my answer? No, thus it must be your document. – Henri Menke Jun 22 '17 at 3:10
1

You could replace \item, but you would have to do it over again for every description environment.

\documentclass{article}
\usepackage{enumitem}
\usepackage{ifoddpage}
\usepackage{showframe}

\setlist[itemize]{noitemsep, topsep=0pt}

\newcommand{\biglabel}[1]% #1 = label for \item
{\checkoddpage
  \bgroup% use local registers
  \ifoddpageoroneside% compute margin size
    \dimen0=\oddsidemargin
  \else
    \dimen0=\evensidemargin
  \fi
  \advance\dimen0 by 1in
  \settowidth{\dimen1}{\textbf{#1}}% compute label size
  \ifdim\dimen1>\dimen0
    \smash{\parbox[t]{\dimen0}{\raggedleft #1}}%
  \else
    #1
  \fi
\egroup}

\begin{document}
\begin{description}[align=right]
\item[\biglabel{Another Rate of Reinforcement}] Text that doesn't matter. The label is the same label that I need to use.
The question is what happens to the second line,
\end{description}
1

Try the following. You can play with values for leftmargin and labelindent (give it a negative value to move it into the margin).

\documentclass[12pt, letterpaper, oneside, draft]{memoir}
\usepackage{enumitem}

% itemize environment configuration
\setlist[itemize]{noitemsep, topsep=0pt}
\SetLabelAlign{parright}{\parbox[t]{\labelwidth}{\raggedleft#1}}


\begin{document}
\lipsum[1]
\begin{description}[style=multiline,leftmargin=1in,labelindent=-\leftmargin,align=parright]

\item[Rate of Reinforcement] Text that doesn't matter. The label is the same label that I need to use.
\item[Reinforcement] Text that doesn't matter. The label is the same label that I need to use.

\end{description}

\end{document}

output of code

  • 1
    Um, that also doesn't work. Now the label is not inside the margin. I would prefer for it to be in the margin. – K. Shores Jun 21 '17 at 3:25
  • 1
    I'm not really sure I've understood the requirement. But maybe the updated answer helps. – Alan Munn Jun 21 '17 at 4:34
  • 1
    Do you want the effect of style=multiline,align=parright,leftmargin=0pt,labelwidth=10em instead? – Andrew Swann Jun 21 '17 at 6:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.