我如何控制这个逻辑证明在页面上?无论内容如何,我都希望它水平延伸到整个页面。间距应位于语句和对齐之间。
\documentclass{article}
\usepackage{logicproof}
\begin{document}
some text
\begin{logicproof}{0}
statement & justification \\
\forall x \, P(x) & premise \\
\forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}
答案1
环境logicproof
正在使用环境tabular
。要定义具有特定宽度的表格,您可以使用包/环境tabularx
:
\documentclass{article}
\usepackage{logicproof}
\usepackage{tabularx}
\newcolumntype{R}{>{\raggedleft\arraybackslash}X}
\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<{$}@{~~~~}R}}%%changed l to R
}{%
\def\lp@tab@format%
{{r@{~~~}*{#1}{l}@{~}>{$}l<{$}@{~~~~}l@{~}*{#1}{R}}}%changed l to R
}%
\center%
\begingroup%changed definition
\edef\x{\endgroup\noexpand\tabularx{\linewidth}{\lp@tab@format}}
\x%
\lp@start@proof@line%
}{%
\lp@stop@proof@line%
\endtabularx%
\endcenter%
\setcounter{lp@total@nests}{0}%
\ifthenelse{%
0=\value{lp@nested}
}{% All is well.
}{% There are still open subproofs.
\def\@currenvir{subproof}%
}
}
\makeatother
\begin{document}
some text
\begin{logicproof}{0}
statement & justification \\
\forall x \, P(x) & premise \\
\forall x \, Q(x) & $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}
答案2
@MarcoDaniel 的回答是一个非常深入的解决方案。我提供一个稍微差一点、不太专业、不太实际的解决方案。只需插入一个空格:
\documentclass{article}
\usepackage{logicproof}
\newdimen\logicgap
\logicgap=0.5\textwidth
\begin{document}
some text
\begin{logicproof}{0}
statement & \hspace{\logicgap} justification \\
\forall x \, P(x) & \hspace\logicgap premise \\
\forall x \, Q(x) & \hspace\logicgap $\forall x \, \mathrm{i}$ 3--5
\end{logicproof}
\end{document}
要了解 LaTeX 中的长度计算方式,请参阅这邮政。