5

I have a description like below. The main issue is if the text is to long it runs underneath the beginning.

\begin{description}
    \item[Languages:] C, C++,Python, Ruby, Shell Scripting (Bash), JavaScript, PHP, Ruby On Rails. Java, C\#, X86, MIPS, Lisp, Standard ML, Scheme, XML, HTML
    \item[OS:] Windows, Ubuntu, Mint, Fedora, AIX, UNIX
\end{description}

What happens is the end of the languages item goes under "Languages". It starts about right in the middle. I want it to go and start right under C. I desire it to look like so

Languages: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
           AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
           AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

not

Languages: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

MWE

\documentclass[11pt]{article}

\usepackage{url,fancyhdr}
\usepackage{enumitem}

\begin{document}
\newcommand{\marginhead}[1]    {  \marginpar{\textsf{{\footnotesize\vspace{-1em}\flushright #1}}}}

\def\ind{\hangindent=1 true cm\hangafter=1 \noindent}

\def\labelitemi{~}
\renewcommand{\labelitemii}{~}

\reversemarginpar

\marginhead{{\vskip 0.3em}Entertainment}
\medskip

\begin{description}[align=right,labelindent=!]
\addtolength{\itemsep}{-0.5\baselineskip}
\item[Sports:] Football, Baseball, Soccer, Rugby, Tennis, Basketball, badminton, swimming, track and field, diving, 
\item[Television Shows:] The Sopranos, The price is right, Dr. Phil, Dexter, CSI, CSI New York, CSI Miami, Las Vegas, Breaking Bad, LA Law, Law and Order.
\end{description}

\end{document}
hpesoj626
  • 17,282
Bobdul
  • 3,217

2 Answers2

7

Will this do for you?

Code

%http://tex.stackexchange.com/questions/91122/uniform-indent-on-description
\documentclass{article}

\usepackage{lipsum} \usepackage{enumitem}

\begin{document} \begin{description}[align=right,labelindent=!] \item[Languages:] C, C++,Python, Ruby, Shell Scripting (Bash), JavaScript, PHP, Ruby On Rails. Java, C#, X86, MIPS, Lisp, Standard ML, Scheme, XML, HTML \item[OS:] Windows, Ubuntu, Mint, Fedora, AIX, UNIX \item[lipsum:] \lipsum[1] \end{description} \end{document}

Output

enter image description here

For the MWE provided: 2013/01/12

I don't know what you are using the difinition of \labelitemi and \labelitemii so I removed them from the solution below. With enumitem you can use the option leftmargin=<length> to manually set up the horizontal distance from the left margin. You can replace 1.75\marginparwidth with a length you prefer, say 1.5in. I just included the showframe option to geometry package so that you can see the borders for the margins.

\documentclass[11pt]{article}

\usepackage[showframe]{geometry} \usepackage{url,fancyhdr} \usepackage{enumitem} \usepackage{lipsum}

\newcommand{\marginhead}[1]{\marginpar{\textsf{{\footnotesize\vspace{-1em}\flushright #1}}}}

\reversemarginpar

\begin{document}

\marginhead{{\vskip 0.3em}Entertainment} \medskip

\begin{description}[align=right,labelindent=!,leftmargin=1.75\marginparwidth] %\addtolength{\itemsep}{-0.5\baselineskip} \item[Sports:] Football, Baseball, Soccer, Rugby, Tennis, Basketball, badminton, swimming, track and field, diving, \item[Television Shows:] The Sopranos, The price is right, Dr. Phil, Dexter, CSI, CSI New York, CSI Miami, Las Vegas, Breaking Bad, LA Law, Law and Order. \item[Languages:] C, C++,Python, Ruby, Shell Scripting (Bash), JavaScript, PHP, Ruby On Rails. Java, C#, X86, MIPS, Lisp, Standard ML, Scheme, XML, HTML \item[OS:] Windows, Ubuntu, Mint, Fedora, AIX, UNIX \item[lipsum:] \lipsum[1] \end{description}

\end{document}

hpesoj626
  • 17,282
  • Doesn't seem to work. It first complains like so

    ! Missing number, treated as zero.

    ! l.199 ...n{description}[align=right,labelindent=!]

    If I add a number in where ! is it just shifts over the entire item lines

    – Bobdul Jan 10 '13 at 03:33
  • @Bobdul Can you put \listfiles in your preamble and look at your .log file to see the versions of packages you are running? I run this with enumitem 2011/09/28 v.3.5.2. What operating system are you using anyway? – hpesoj626 Jan 10 '13 at 03:38
  • I am using Ubuntu 12.04. Seems I have an older version

    enumitem.sty 2009/05/18 v2.2 Customized lists

    – Bobdul Jan 10 '13 at 05:05
  • I suggest you install TeXLive 2012. See this post on how to install Vanilla TeXLive 2012: http://tex.stackexchange.com/questions/1092/how-to-install-vanilla-texlive-on-debian-or-ubuntu. There is also a post in askubuntu: http://askubuntu.com/questions/163682/how-do-i-install-the-latest-tex-live-2012. As for installing individual packages. See also this post if you want to install individual packages from CTAN: http://tex.stackexchange.com/questions/73016/how-do-i-install-an-individual-package-on-a-linux-system – hpesoj626 Jan 10 '13 at 05:32
  • I installed the newest Texlive. one issue I have though is the overall items are being moved over to the left onto the margin. They aren't staying put. Even if I cut the longer lines with \ the item is still moving over. If I don't use [align=right,labelindent=!] it goes away. Thanks again. – Bobdul Jan 11 '13 at 03:40
  • @Bobdul I can't see what is happening in your code unless you provide a compilable minimal working example (MWE), one which begins with \documentclass complete with \begin{document} ... \end{document}. Can you strip your document down to the least amount of code which compiles and which produces the weird outcome and then come back here for the update? – hpesoj626 Jan 11 '13 at 10:38
  • added in the OP – Bobdul Jan 12 '13 at 01:35
2

I find the package eqlist to be very helpful for such instances. The code given by hpesoj626 can be rewritten as

\documentclass{article}

\usepackage{lipsum}
\usepackage{eqlist}

\begin{document}
\begin{eqlist}
    \item[Languages:] C, C++,Python, Ruby, Shell Scripting (Bash), JavaScript, PHP, Ruby On Rails. Java, C\#, X86, MIPS, Lisp, Standard ML, Scheme, XML, HTML
    \item[OS:] Windows, Ubuntu, Mint, Fedora, AIX, UNIX
    \item[lipsum:] \lipsum[1]
\end{eqlist}
\end{document}
mas
  • 1,333