2

How can you align certain lines at a certain place. For example when I write it up normally in latex is displays the following:

enter image description here

But I want it to display it like this instead:

enter image description here

So in other words, I want to find a way to make sure that each question lines up with each other. I know you can do this using the \align command for equations, but not sure what the command is for normal sentences.


To add to my question, how can you align a sentence in three places and place a word right before the ampersand sign?

enter image description here

For example in the above picture, I want all the ordinal numbers and numbers and 500s (all the circled columns) to be lined up with each other. When I tried doing it I ended with spaces between the "to" and "500" which I want to get rid of. I also want the quotations marks to come right before the numbers in the second and third column which I am not sure how to do.

Thanks for any help!

1
  • 1
    Depending on the specifics, a tabular or enumerate environment could be employed. – Steven B. Segletes Jan 15 '18 at 3:33
3

A \parbox directive will generate the "look" of the second screenshot you provided.

enter image description here

\documentclass{article}
\begin{document}
\noindent
Eg 1.\ 
\parbox[t]{0.8\textwidth}{%
  a) What is the rate of decrease of its radius \dots\par
  b) Find the time taken to reduce the radius of \dots\par
  c) Find the time taken to reduce the radius of \dots}
\end{document}

However, using a tabularx environment should provide better alignment of the (implicit) columns.

enter image description here

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent
\setlength\tabcolsep{3pt} % default value is 6pt
\begin{tabularx}{\textwidth}{@{}llX@{}}
Eg 1. 
  & a) & What is the rate of decrease of its radius \dots \\
  & b) & Find the time taken to reduce the radius of \dots\\
  & c) & Find the time taken to reduce the radius of \dots \\
\end{tabularx}
\end{document}

Addendum to address the OP's follow-up question: Again, using a plain old tabular environment seems indicated. And, do let LaTeX handle the chores of incrementing and decrementing numbers. :-)

enter image description here

\documentclass{article}
\usepackage{array}           % for "\newcolumntype" macro
\newcolumntype{L}{>{$\displaystyle}l<{$}} % automatic math mode
\usepackage{fmtcount}        % for "\ordinalnum" macro
\usepackage[T1]{fontenc}     % access "\textquotedbl" macro

\newcounter{mynuma}\newcounter{mynumb}
\newcommand{\decnumb}{\setcounter{mynumb}{\numexpr21-\value{mynuma}\relax}}
\newcommand\mymac{\stepcounter{mynuma}\decnumb\ordinalnum{\value{mynuma}}}

\begin{document}
\begin{center}
\setlength\tabcolsep{2pt} % default: 6pt
\begin{tabular}{@{} llrll L @{}}
\mymac & 500 invested for & \themynumb & years & amount to     & 500\times1.06^{\themynumb} \\
\mymac & \textquotedbl    & \themynumb & years & \textquotedbl & 500\times1.06^{\themynumb} \\
$\vdots$ \addtocounter{mynuma}{16}\\
\mymac & \textquotedbl    & \themynumb & years & \textquotedbl & 500\times1.06^{\themynumb} \\
\mymac & \textquotedbl    & \themynumb & year  & \textquotedbl & 500\times1.06^{\themynumb} \\
\end{tabular}
\end{center}
4
  • how can I align the sentence at 3 places instead of 2? – Nanoputian Jan 30 '18 at 7:47
  • @Nanoputian - Please be more specific about what you're trying to achieve. E.g., where would/should the three alignment points occur? – Mico Jan 30 '18 at 10:14
  • I will add it as an edit to my original question since I cant insert pictures in the comments – Nanoputian Jan 30 '18 at 21:50
  • @Nanoputian - I've edited my answer to provide an answer to your follow-up question. A general comment: Since the follow-up question isn't all that closely related to the original question, you should have posted a new query. That way, many more people are likely to see it and (hopefully) think about providing an answer. – Mico Jan 31 '18 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.