如何使自定义描述列表中的标签左对齐

如何使自定义描述列表中的标签左对齐

我有这个代码:

\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}

    \section{Project 55d5396fed}
    \begin{tabular}{@{\hspace{19ex}}p{42em}}
    \begin{description}

    \item[student number] 55d5396fed



 \item[student name] We have already seen that a case of semigrammaticalness of a different sort is necessary to impose
an interpretation on irrelevant intervening contexts in selectional rules.

      \item[location] Of course, the fundamental error of regarding functional notions as categorial is to be regarded as
nondistinctness in the sense of distinctive feature theory.

       \end{description}
       \end{tabular}

标签右对齐。我希望标签左对齐。我的意思是items

答案1

这是实现你想要的快速而肮脏的方法。我所做的就是改变你的

\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}

\SetLabelAlign{rightbox}{\hspace{-19ex}\rlap{#1\quad}}

之前的输出:

在此处输入图片描述

之后的输出:

在此处输入图片描述

完整代码变为:

\documentclass{article}
\usepackage{enumitem}
\begin{document}

%\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\SetLabelAlign{rightbox}{\hspace{-19ex}\rlap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}

    \section{Project 55d5396fed}
    \begin{tabular}{@{\hspace{19ex}}p{42em}}
    \begin{description}

    \item[student number] 55d5396fed



 \item[student name] We have already seen that a case of semigrammaticalness of a different sort is necessary to impose
an interpretation on irrelevant intervening contexts in selectional rules.

      \item[location] Of course, the fundamental error of regarding functional notions as categorial is to be regarded as
nondistinctness in the sense of distinctive feature theory.

       \end{description}
       \end{tabular}

\end{document}

相关内容