3

I wish to left align justifications in mathematical/logical reasoning. I am currently in an enumerate tag.

I have:

a) p or q by fact(10)
b) r by negation on (a, 10)
c) s by implication(b, 5)
.
.

I would like to turn the above into:

a) p or q     by fact(10)
b) r          by negation on  (a, 10)
c) s          by implication (b, 5)
.
.

I would know how to do this without the enumeration of the alphabet going down the left side of the page. I could simply just use an align tag.

  1. How do I get the above alignment in an enumeration?

Thanks in advance!

  • Do the list of items need to be breakable across the page boundary? If not, then this can be achieved using a tabular. – Werner Aug 25 '13 at 2:16
3

If you know the sentences will be relatively short, you can use a tabbing environment and a counter.

\documentclass{article}
\newcounter{mycurrentline}
\def\postNumberForLine{\stepcounter{mycurrentline}\alph{mycurrentline})}
\pagestyle{empty}
\begin{document}

\begin{tabbing}
\postNumberForLine\ \= p or q \= by fact (10) \\
\postNumberForLine \> r      \> by negation on (a, 10)\\
\postNumberForLine \> s      \> by implicaiton (b,5)
\end{tabbing}

\end{document}

enter image description here

Alternatively, you could use a tabular environment:

\documentclass{article}
\usepackage{array}
\newcounter{mycurrentline}
\def\postNumberForLine{\stepcounter{mycurrentline}\alph{mycurrentline})}
\pagestyle{empty}
\begin{document}

\begin{tabular}{>{\postNumberForLine}ccl}
& p or q & by fact (10) \\
& r      & by negation on (a, 10)\\
& s      & by implicaiton (b,5)
\end{tabular}

\end{document}

The nice thing about a tabular environment is that you can use the column directive p{<dim>} for the last column to make it a minipage of a specified width.

For this particular tabular environment, I made both the first and second columns centered. The last column is left aligned. Also, I loaded the array package. That allows me to prepend (or postpend) instructions for each row of the table: this is achieve by >{<commands} to prepend. I also prepended \raggedright to the p column declaration to avoid hyphenation.

enter image description here

Here's a slightly different example to illustrate the p option:

\documentclass{article}
\usepackage{amsmath,array}
\newcounter{mycurrentline}
\def\postNumberForLine{\stepcounter{mycurrentline}\alph{mycurrentline})}
\pagestyle{empty}
\begin{document}

\begin{tabular}{>{\postNumberForLine}c>{$}c<{$}>{\raggedright}p{2in}r}
 & p \text{ or } q & This is the disjunction of proposition $p$ and proposition $q$ & by fact        (10)   \\
 & r               &                                                                & by negation on (a, 10)\\
 & s               &                                                                & by implicaiton (b,5)
\end{tabular}

\end{document}

I've done both prepending and postpending of instructions. For the second column, I've made sure the content is in math mode. Also, I've loaded the amsmath package to allow me to add \text{ and } to properly format the and in the middle of math mode.

enter image description here

If your table might have to straddle a page boundary, then you also might want to consider the longtable package.

  • How do you show the results of your Latex Code? I wish to know so that I can make better questions. – CodeKingPlusPlus Aug 25 '13 at 2:28
  • I upload a png file that I've copied from my desktop. – A.Ellett Aug 25 '13 at 2:29
  • 2
    @CodeKingPlusPlus: See How can I upload an image to be included in a question or answer? – Werner Aug 25 '13 at 2:30
  • @Werner Is that post still accurate about the file type? I've noticed recently that I've only been able to upload png files. – A.Ellett Aug 25 '13 at 2:39
  • @A.Ellett: I just tested in with JPG and it worked fine. I'll have to add something about the possibility to drag-and-drop though. I'll update the post with that information. – Werner Aug 25 '13 at 4:46
0

The not-so-perfect listliketab package.

See also this answer of mine to How to force alignment of "cases" brackets in an enumerate environment?

Code

\documentclass[12pt]{scrartcl}
\usepackage{enumitem,amsmath}
\usepackage{listliketab}
\newcounter{listliketablabel}
\newcommand*{\nextnum}{\addtocounter{listliketablabel}{1}\thelistliketablabel)}
\makeatletter
\newcommand*{\storestyleofextra}[2][]{%
    \begin{lrbox}{\llt@list@box}
        \noindent
        \begin{minipage}{\linewidth}
            \begin{#2}[#1]
            \item[] %\storeliststyle{}
            \end{#2} \storeliststyle{}%\edef\llt@bot@sep@{\the\llt@bot@sep}
%            \begin{#2}[#1]
%              \item[] %\storeliststyle{}\global\llt@bot@sep\llt@bot@sep@
%            \end{#2} 
        \end{minipage}
    \end{lrbox}\ignorespacesafterend
}
\storestyleofextra[label=\alph*)]{enumerate}
\newenvironment{alignerate}[1]{%
    \begin{listliketab}%
        \setcounter{listliketablabel}{0}\renewcommand*{\thelistliketablabel}{\alph{listliketablabel}}%
        \renewcommand*{\item}{\nextnum &}%
    \begin{tabular}{L#1R}
}{
    \end{tabular}
    \end{listliketab}\hfill\newline
}
\makeatother
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{alignerate}{>{$}c<{$} >{\raggedright} p{2in} r}
    \item p \text{ or } q & This is the disjunction of proposition $p$ and proposition $q$ & by fact        (10)    \\
    \item r               &                                                                & by negation on (a, 10) \\
    \item s               &                                                                & by implicaiton (b,5)   \\
\end{alignerate}
\lipsum[2]
\begin{enumerate}[label=\alph*)]
\item $p$ or $q$
\item $r$
\item $s$
\end{enumerate}
\lipsum[3]
\end{document}

Output

enter image description here

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.