自定义两列文本

自定义两列文本

我有一个问题,如下图所示。基本上,我想在页面左侧显示一行,在右侧显示描述。

我尝试过的方法是使用 minipage 环境和 \qquad水平间距。

我目前拥有的。

现在的问题是,正如您在图片中看到的那样,右侧的文本没有对齐。我知道这是因为命令\qquad通过固定安装缩进,如果左侧的文本不如前一个文本长,我就会陷入困境。

\textit{Elastic modulus, \textbf{E}}
\qquad
\begin{minipage}[t]{9cm}
  Steel is easy to bend \textit{elastically} means that it springs back when released. Its resistance to bending, \textit{elastic stiffness}, is set by shape and the property, \textit{elastic modulus, E}. Materials with high \textit{E}, like steel, are intrinsically stiff; those with low \textit{E}, like polyethylene, are not.
\end{minipage}
\textit{Yield strength, \textbf{$\sigma_y$}}
\qquad
\begin{minipage}[t]{9cm}
    This is the 
\end{minipage}

我希望有人能帮助我!

问候,迈克尔

答案1

使用列表

\documentclass{article}

\usepackage{enumitem}
\begin{document}
\begin{description}[font=\normalfont\itshape,leftmargin=4cm,labelwidth=!]
\item[Elastic modulus, \textbf{E}]
  Steel is easy to bend \textit{elastically} means that it springs back when released. Its resistance to bending, \textit{elastic stiffness}, is set by shape and the property, \textit{elastic modulus, E}. Materials with high \textit{E}, like steel, are intrinsically stiff; those with low \textit{E}, like polyethylene, are not.

\item[Yield strength, \textbf{$\sigma_y$}]
    This is the
\end{description}
\end{document}

在此处输入图片描述

答案2

列表的另一种变体。

\documentclass{article}

\newlength\mylistindent
\newcommand{\mylist}[1]{\par\addvspace{2pt}
  \noindent \hangindent\mylistindent
  \makebox[\mylistindent]{#1\hfill}\ignorespaces
}

\begin{document}

\settowidth\mylistindent{the longest entry\qquad}

\mylist{\textit{Elastic modulus, \textbf{E}}} Steel is easy to bend
 \textit{elastically} means that it springs back when released. Its
 resistance to bending, \textit{elastic stiffness}, is set by shape and
 the property, \textit{elastic modulus, E}. Materials with high
 \textit{E}, like steel, are intrinsically stiff; those with low
 \textit{E}, like polyethylene, are not.

\mylist{Second} this is the text for the second item.  It is
  very long, and may require several lines.
\mylist{Another} one more here
\mylist{Final} one more to finish off.

\medskip
\noindent
You'll need to put in some explicit space at the end.

\end{document}

缩进列表,来自示例代码

如果所描述的元素是一个非常长的短语(这会使右侧块非常狭窄),则可以相对容易地扩展此功能以允许左侧有多行。如果需要该功能,请说出来,我会提供扩展。

相关内容