我实际上是想将 Word 文档文件复制到 LaTeX 中。我遇到了让 LaTeX 文件看起来与我需要复制的 Word 文档完全一样(或至少接近)的问题。特别是,尽管我付出了努力,我想要的水平对齐仍然不起作用。
我尝试使用诸如\hspace{.1cm}
、$\>$
和 之类的命令\quad
(将这些命令放在我想要插入的行之前),但它们没有任何作用。例如,我希望短语“数字 8.1”与短语“下列哪一项”水平对齐,如下所示。
我想要的是:
这是我的代码:
\documentclass[10pt]{article}
\usepackage{times}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{enumitem}
\begin{document}
\twocolumn
\begin{enumerate}[leftmargin=*]
\item \hspace{.1cm} Which of the following is the best interpretation
of the number 8.1 in the model?\newline
A) The stalk grew 8.1 centimeters each day.\newline
B) The stalk grew 1 centimeter every 8.1 days.\newline
C) The stalk was 8.1 centimeters tall when the student began
observing.\newline
D) The students observed the stalk for 8.1 days.
\end{enumerate}
\end{document}
答案1
我不明白你为什么要用 LaTeX 模拟 Word 输出。通常,默认情况下 LaTeX 输出效果更佳。话虽如此,你可以轻松地通过以下方式实现你的目标enumitem
:
- 只需省略
\hspace{.1cm}
!您还需要itemindent=0pt
,但这是默认的。 - 不要插入手动换行符(这几乎从来都不是一个好主意);相反,使用嵌套列表。为了获得所需的对齐,您需要
label={\Alph*)}, labelindent=0pt, leftmargin=*
。 - 为了获得您想要的紧密间距(通常不太好),您可以使用
nosep
。 margin=1in
如果您不需要使用它,我不推荐它。~
必要时使用不间断空格 ( )。- 我建议使用
siunitx
数字。
enumitem
有关水平对齐的工作原理的详细信息,请参阅这个答案。
\documentclass[10pt, twocolumn]{article}
\usepackage{times}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{enumitem}
\usepackage{siunitx}
\begin{document}
\begin{enumerate}[nosep] % itemindent=0pt is the default
\item Which of the following is the best interpretation of the number~\num{8.1} in the model?
\begin{enumerate}[label={\Alph*)}, labelindent=0pt, leftmargin=*, nosep]
\item The stalk grew \num{8.1}~centimeters each day.
\item The stalk grew \num{1}~centimeter every \num{8.1}~days.
\item The stalk was \num{8.1}~centimeters tall when the student began observing.
\item The students observed the stalk for \num{8.1}~days.
\end{enumerate}
\end{enumerate}
\end{document}
答案2
使用以下内容:
\documentclass[10pt]{article}
\usepackage{times}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{enumerate}
\begin{document}
\twocolumn
\begin{enumerate}
\item Which of the following is the best interpretation of the number 8.1 in the model?
\begin{enumerate}[A)]
\item The stalk grew 8.1 centimeters each day.
\item The stalk grew 1 centimeter every 8.1 days.
\item The stalk was 8.1 centimeters tall when the student began observing.
\item The students observed the stalk for 8.1 days.
\end{enumerate}
\end{enumerate}
\end{document}
答案3
\documentclass[10pt]{article}
\usepackage{times}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{enumerate}
\begin{document}
1. Which of the following is the best interpretation of the number 8.1 in the model?\\
\vspace{0.5cm}
\begin{tabular}{p{8cm}}
A) &
The stalk grew 8.1 centimeters each day.\\
B) & The stalk grew 1 centimeter every 8.1 days.\\
C) & The stalk was 8.1 centimeters tall when the student began observing.\\
D) & The students observed the stalk for 8.1 days.\\
\end{tabular}
\end{document}
This is without any packages.
答案4
\documentclass[10pt]{article}
\usepackage{times}
\usepackage{geometry}
\geometry{margin=1in}
\usepackage{enumerate}
\begin{document}
1. Which of the following is the best interpretation of the number 8.1 in the model?\\
\vspace{0.5cm}
\begin{tabular}{p{1 cm}p{8cm}}
A) &
The stalk grew 8.1 centimeters each day.\\
B) & The stalk grew 1 centimeter every 8.1 days.\\
C) & The stalk was 8.1 centimeters tall when the student began observing.\\
D) & The students observed the stalk for 8.1 days.\\
\end{tabular}
\end{document}
这是没有任何包的。错误是因为它只有一个表格列,而我们需要 2 个。现在我添加了一个附加列p{1 cm}
包enumerate
未使用。