框旁边的缩进段落

框旁边的缩进段落

我正在尝试将整个段落缩进编号框的右侧。但是,该段落似乎没有与该框垂直对齐。我使用以下代码:

\documentclass[journal,onecolumn]{IEEEtran}
\usepackage{amsmath} % for \boxed{}
\usepackage{mathtools} % also loads amsmath

\begin{document}
\boxed{\textbf{R1.1}} 

\setlength{\leftskip}{1.45cm}
\noindent \textit{The central goal of the SHRP 2 Safety research program was 
to address the role of driver performance and behavior in traffic safety. 
This included developing an understanding of how the driver interacts with 
and adapts to the vehicle, traffic environment, roadway characteristics, 
traffic control devices, and the environment. It also included assessing the 
changes in collision risk associated with each of these factors and 
interactions. This information will support the development of new and 
improved countermeasures with greater effectiveness.}

\setlength{\leftskip}{0pt}

\end{document}

答案1

如果应该将段落放在框旁边,则立即的解决方案是使用命令\llap,以抑制框的宽度:

\documentclass[journal,onecolumn]{scrartcl}
\usepackage{amsmath} % for \boxed{}
\usepackage{mathtools} % also loads amsmath

\begin{document}
\setlength{\leftskip}{1.45cm}

\noindent%
\llap{%
    \boxed{\normalfont\textbf{R1.1}}%
    \hspace{1em}%
}%
\textit{%
    The central goal of the SHRP 2 Safety research program was 
    to address the role of driver performance and behavior in traffic safety. 
    This included developing an understanding of how the driver interacts with 
    and adapts to the vehicle, traffic environment, roadway characteristics, 
    traffic control devices, and the environment. It also included assessing the 
    changes in collision risk associated with each of these factors and 
    interactions. This information will support the development of new and 
    improved countermeasures with greater effectiveness.
}

\setlength{\leftskip}{0pt}
\end{document}

然而,更好的解决方案是使用列表。为此,enumitem是一个非常方便的包,用于处理涉及itemize或环境的长度:enumeratedescription

\documentclass[journal,onecolumn]{scrartcl}
\usepackage{amsmath} % for \boxed{}
\usepackage{mathtools} % also loads amsmath
\usepackage{enumitem}
\begin{document}
\begin{description}[leftmargin=1.45cm, labelwidth=1.2cm, labelsep=2.5mm]
\item[\boxed{\normalfont\textbf{R1.1}}]
    The central goal of the SHRP 2 Safety research program was 
    to address the role of driver performance and behavior in traffic safety. 
    This included developing an understanding of how the driver interacts with 
    and adapts to the vehicle, traffic environment, roadway characteristics, 
    traffic control devices, and the environment. It also included assessing the 
    changes in collision risk associated with each of these factors and 
    interactions. This information will support the development of new and 
    improved countermeasures with greater effectiveness.
\end{description}
\end{document}

在此处输入图片描述

相关内容