统一缩进描述

统一缩进描述

我有如下描述。主要问题是如果文本太长,它会跑到开头下面。

\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}

结果是语言项目的末尾位于“语言”下。它从中间开始。我希望它从 C 下开始。我希望它看起来像这样

Languages: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
           AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
           AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

不是

Languages: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
      AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

平均能量损失

\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}

答案1

我发现 eqlist 包对于这种情况非常有用。hpesoj626 给出的代码可以重写为

\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}

答案2

这对你有用吗?

代码

%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}

输出

在此处输入图片描述

对于 MWE 提供:2013/01/12

我不知道您使用的是 的定义\labelitemi\labelitemii所以我从下面的解决方案中删除了它们。enumitem您可以使用选项leftmargin=<length>手动设置从左边距的水平距离。您可以用1.75\marginparwidth您喜欢的长度替换,比如1.5in。我只是包含了打包showframe选项geometry,以便您可以看到边距的边框。

\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}

相关内容