我正在使用此代码
\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}
\usepackage[inline]{enumitem}
\usepackage[table]{xcolor}
\definecolor{orange}{HTML}{FFC296}
\begin{document}
\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
\item[number] 93b4s27156c
\item[name] Note that this analysis of a formative as a pair of sets of features is necessary
to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}
并给出这个输出
有什么方法可以将学生部分下的所有标签对齐,而不是部分的左侧
答案1
这个想法是使用您的代码,然后使用附加列表(在包的帮助下changepage
)作为包装器,以获得所需的左边距。新定义的环境mdesc
需要知道最宽的标签,以便进行必要的计算;这个最长的标签必须作为环境的强制参数给出:
\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}
\usepackage[inline]{enumitem}
\usepackage{calc}
\usepackage{changepage}
\setlist[description,1]{labelsep=0pt,leftmargin=0pt}
\newenvironment{mdesc}[1]
{
\begin{adjustwidth}{\widthof{{\bfseries#1}\quad}}{0pt}
\begin{description}[before={
\renewcommand\makelabel[1]{%
\llap{\makebox[\widthof{\bfseries#1}][l]{\hfill\bfseries####1}\quad}}}]
}
{\end{description}\end{adjustwidth}}
\begin{document}
\section{Student 93b427156c}
\begin{mdesc}{number}
\item[number] 93b4s27156c
\item[name] Note that this analysis of a formative as a pair of sets of features is necessary
to impose an interpretation on an important distinction in language use.
\end{mdesc}
\end{document}
答案2
我不确定如何直接将段落与节名称对齐。其他人可能会这样做。相反,这里有一种模拟类似布局的方法,使用longtable
。看看你的想法。
\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}
\usepackage{longtable}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{graphicx}
\definecolor{orange}{HTML}{FFC296}
\begin{document}
\begin{longtable}[l]{ l l p{10cm}}
\textbf{{\Large 1}} & \multicolumn{2}{l}{\textbf{{\Large Student 93b4s27156c}}} \\[2ex]
& \textbf{number} & 93b4s27156c \\[2ex]
& \textbf{name} & Note that this analysis of a formative as a pair of sets of features is necessary to impose an interpretation on an important distinction in language use.h \\[2ex]
\end{longtable}
%\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
%\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
\item[number] 93b4s27156c
\item[name] Note that this analysis of a formative as a pair of sets of features is necessary to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}
这就是结果(与您最初得到的结果相同,如下所示):
答案3
您已经有了框架 - 唯一需要更改的是部分格式。titlesec
在这里非常有用-我唯一要补充的是
% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip.5cm}}
{0pt}
{}
输出如下
% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass{article}
\usepackage[inline]{enumitem}
\usepackage{titlesec}
% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip.5cm}}
{0pt}
{}
\begin{document}
\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
\item[number] 93b4s27156c
\item[name] Note that this analysis of a formative as a pair of sets of features is necessary
to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}