# Left-aligned logicproof

I'm typesetting a natural deduction proof. These consist of several numbered statements along with justifications. I'm using the logicproof package, and a minimal example looks something like this:

\documentclass[article]
\usepackage{logicproof}
\begin{document}
text
\begin{logicproof}{0}
statement & justification
\end{logicproof}


It compiles into this (black bars show geometry of page):

I'd like the proof to be aligned on the left (as with the rest of the text), but I can't see any mention of how to do this in the package documentation. I believe that the package uses tabular under the hood.

I've tried to redefine \center to hack around this, and the following code seems to do the trick - but I'm unsure if this is good practice or not.

\def\center{\trivlist\item\relax}
\def\endcenter{\endtrivlist}


Is there a better approach? Should I use \renewcommand instead?

In the definition of the logicproof environment the commands \center and \endcenter are used.

The easiest way to fix this is by using the \patchcmd command from the etoolbox package:

\documentclass{article}
\usepackage{logicproof,etoolbox}

\patchcmd{\logicproof}{\center}{\flushleft}{}{}
\patchcmd{\endlogicproof}{\endcenter}{\endflushleft}{}{}

\begin{document}
\noindent text
\begin{logicproof}{0}
statement & justification
\end{logicproof}

\end{document}


Another fix is to simply replace these with \flushleft and \endflushleft in a \renewenvironment{logicproof} in your preamble:

\documentclass{article}
\usepackage{logicproof}

\makeatletter
\renewenvironment{logicproof}[1]{%
\setcounter{lp@line}{0}%
\setcounter{lp@nested}{0}%
\setcounter{lp@total@nests}{#1}%
\setlength{\tabcolsep}{0mm}%
\let\lp@orig@arraycr\@arraycr%
\renewcommand{\@arraycr}{\lp@cr}%
\renewcommand{\@currentlabel}{\p@lp@line\thelp@line}%
\ifthenelse{%
0=#1%
}{%
\def\lp@tab@format{{r@{~~~}>{$}l<{$}@{~~~~}l}}%
}{%
\def\lp@tab@format%
{{r@{~~~}*{#1}{l}@{~}>{$}l<{$}@{~~~~}l@{~}*{#1}{r}}}
}%
%\center% <-- REMOVED
\expandafter\tabular\lp@tab@format%
\lp@start@proof@line%
}{%
\lp@stop@proof@line%
\endtabular%
%\endcenter% <-- REMOVED
\setcounter{lp@total@nests}{0}%
\ifthenelse{%
0=\value{lp@nested}
}{% All is well.
}{% There are still open subproofs.
\def\@currenvir{subproof}%
}
}
\makeatother

\begin{document}
\noindent text
\begin{logicproof}{0}
statement & justification
\end{logicproof}

\end{document}


Both solutions yield identical output: