按项目符号样式对齐文本

按项目符号样式对齐文本

我想将我的文章格式化如下图所示:

在此处输入图片描述

原始文本:

 Before scientists can develop medicines or engineers can advance
 technology, they throw numbers onto whiteboards using concepts laid
 out by mathematicians sometimes centuries earlier. Generations of
 school children will disagree, but no other field of study has played
 a bigger role in changing the course of history as mathematics. We've
 identified the 20 mathematicians responsible for the modern world.

 Issac Newton   :   While not exactly obscure, this list would be
 incomplete without a mention of Sir Issac Newton, the English luminary
 of the Scientific Revolution. Newton developed early physics, a
 scientific method, the theory of universal gravitation, and
 calculus...

 Gottfried Leibniz  :   Invented infinitesimal calculus independent of
 Englishman Sir Issac Newton. His notation is still widely used
 today...

 Leonhard Euler :   A Swiss mathematician who spent most of his life in
 Russia, Leonhard Euler is considered the preeminent mathematician of
 his generation...

使用 MS Word 很容易做到这一点,但我不知道如何使用 LaTeX 做到这一点。我试过在线搜索,但找不到任何 TeX 网站讨论此事。我突然想到使用这个代码

\begin{itemize}
\item 
\item
\end{itemize}

但它没有产生我想要的格式。我应该使用什么样的代码来产生像屏幕截图那样的格式,特别是使用小方形项目符号,而不是圆形项目符号?

答案1

您可以使用enumitem包并进行调整:

\documentclass{article}
\usepackage{enumitem,amssymb,graphicx}
\newcommand{\mysquare}{\scalebox{0.5}{\raisebox{0.65ex}{$\blacksquare$}}}
\SetLabelAlign{myleft}{\strut\smash{\mbox{}\hspace{\parindent}\parbox[t]\labelwidth{\mysquare \, \raggedright#1\hfill :}}}
\begin{document}
  Before scientists can develop medicines or engineers can advance technology, they throw numbers onto whiteboards using concepts laid out by mathematicians sometimes centuries earlier. Generations of school children will disagree, but no other field of study has played a bigger role in changing the course of history as mathematics. We've identified the 20 mathematicians responsible for the modern world.
%
\begin{itemize}[align=myleft,labelwidth=3.5cm,leftmargin=\dimexpr3.5cm+\parindent+\labelsep\relax]
  \item[Issac Newton]  While not exactly obscure, this list would be incomplete without a mention of Sir Issac Newton, the English luminary of the Scientific Revolution. Newton developed early physics, a scientific method, the theory of universal gravitation, and calculus...
  \item[Gottfried Leibniz] Invented infinitesimal calculus independent of Englishman Sir Issac Newton. His
      notation is still widely used today...
   \item[Leonhard Euler]  A Swiss mathematician who spent most of his life in Russia, Leonhard Euler is considered the preeminent mathematician of his generation...
\end{itemize}

\end{document}

在此处输入图片描述

  1. 我使用包定义了一个正方形。使用 和命令(来自包)amssymb调整了它的大小并稍微凸起了一些。\scalebox\raiseboxgraphicx
  2. \item为as的参数定义一个对齐方式myleft,并具有适当的宽度(此处为 3.5cm,适当调整)。
  3. 用作myleft对齐方式并labelwidth适当调整 leftmargin`。如果您更改 3.5cm,请在此处也进行更改。

要将正方形更改为数字或字母,您可以按如下方式更改代码:

\documentclass{article}
\usepackage{enumitem,amssymb,graphicx}
\newcounter{mycount}
\setcounter{mycount}{0}
%\renewcommand{\themycount}{\arabic{mycount}}  % for numbers
\renewcommand{\themycount}{\alph{mycount}} % for alphabets


\newcommand{\mysquare}{{\refstepcounter{mycount}\bfseries\themycount.}}
\SetLabelAlign{myleft}{\strut\smash{\mbox{}\hspace{\parindent}\parbox[t]\labelwidth{\mysquare \, \raggedright#1\hfill :}}}
\begin{document}
  Before scientists can develop medicines or engineers can advance technology, they throw numbers onto whiteboards using concepts laid out by mathematicians sometimes centuries earlier. Generations of school children will disagree, but no other field of study has played a bigger role in changing the course of history as mathematics. We've identified the 20 mathematicians responsible for the modern world.
%
\begin{itemize}[align=myleft,labelwidth=3.5cm,leftmargin=\dimexpr3.5cm+\parindent+\labelsep\relax]
  \item[Issac Newton]  While not exactly obscure, this list would be incomplete without a mention of Sir Issac Newton, the English luminary of the Scientific Revolution. Newton developed early physics, a scientific method, the theory of universal gravitation, and calculus...
  \item[Gottfried Leibniz] Invented infinitesimal calculus independent of Englishman Sir Issac Newton. His
      notation is still widely used today...
   \item[Leonhard Euler]  A Swiss mathematician who spent most of his life in Russia, Leonhard Euler is considered the preeminent mathematician of his generation...
\end{itemize}

\end{document}

在此处输入图片描述

相关内容