1

I am essentially trying to copy a word document file into LaTeX. I am running into problems getting the LaTeX file to look exactly like (or at least close to) the Word document I need to copy. In particular, the horizontal alignment that I want is not working, despite my efforts.

I've tried using commands like \hspace{.1cm}, $\>$, and \quad (by placing these commands right before the line I want to push in) but they don't do anything. For example, I want the phrase "the number 8.1" to align horizontally with the phrase "Which of the following", as shown below.

bad alignment

What I want, is this:

good alignment

Here is my code:

\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}
Werner
  • 603,163
cdelano
  • 13
  • 1
    Welcome to tex.sx. By adding the \hspace{.1cm} after \item, you are defeating the usual alignment of the item text. The enumitem package has a mechanism for resetting this. By the way, this is an adjustment of the horizontal, not vertical, alignment, and I am changing the tag. – barbara beeton Aug 01 '19 at 16:06

4 Answers4

2

I don't see why you would want to emulate the Word output with LaTeX. Usually, the LaTeX output is superior by default. That said, you can easily achieve what you are aiming for with enumitem:

  • Just leave out the \hspace{.1cm}! You also need itemindent=0pt, but that's the default.
  • Don't insert manual line breaks (that's almost never a good idea); instead, use a nested list. In order to get the alignment you are looking for you need label={\Alph*)}, labelindent=0pt, leftmargin=*.
  • In order to get the tight spacing you want (which is usually not great), you can use nosep.
  • I do not recommend margin=1in if you don't have to use it.
  • Use non-breaking spaces (~) where necessary.
  • I recommend using siunitx for numbers.

For details on how enumitem's horizontal alignment works, see this answer.

\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}

MWE output

schtandard
  • 14,892
  • Thank you, this was a great response. If you're curious, I need to replicate a word file to appear exactly as it does in Word - it might seem like an odd task, but I have to do it nonetheless. Thanks again. – cdelano Aug 01 '19 at 17:10
0

Use the following:

enter image description here

\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}
Werner
  • 603,163
0
\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.
Sigur
  • 37,330
  • Your code can not work. Upon compiling, it will result in "! Extra alignment tab has been changed to \cr.". In your table you only specified 1 columns, but used 2 of them. To make it compilable, use \begin{tabular}{lp{8cm}} instead. Alos, what's the reason for the enumerate package? You don't seem to use it. – leandriis Apr 16 '20 at 07:04
0
\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}

This is without any packages. Error because it had only one tabular column where we need 2. Now I have added an additional column p{1 cm} Package enumerate is not used.

Mensch
  • 65,388