我偶尔使用一下 Latex,并且使用 proof 包自动生成代码来进行证明。
现在我遇到了问题,有了大的证明,我无法将其置于 pdf 的中心,也无法避免溢出。
有什么建议可以解决这个问题吗?
下面是一个带有错误 PDF 的证明示例
% auto generate file, please not modify the content
\documentclass[10pt]{article}
\usepackage{proof}
\usepackage{lscape}
\pdfpagewidth 11in\pdfpageheight 12in\begin{document}
\begin{landscape}\centering\[
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:3] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:3] \rangle \to true}
{\infer[var]
{\langle x, [x:3] \rangle \to 3}
{}
&
\infer[num]
{\langle 1, [x:3] \rangle \to 1}
{}}
&
\infer[assign]
{\langle x := x - 1, [x:3] \rangle \to [x:2]}
{\infer[dec]
{\langle x - 1, [x:3] \rangle \to 2}
{\infer[num]
{\langle 1, [x:3] \rangle \to 1}
{}
&
\infer[var]
{\langle x, [x:3] \rangle \to 3}
{}}}
&
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:2] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:2] \rangle \to true}
{\infer[var]
{\langle x, [x:2] \rangle \to 2}
{}
&
\infer[num]
{\langle 1, [x:2] \rangle \to 1}
{}}
&
\infer[assign]
{\langle x := x - 1, [x:2] \rangle \to [x:1]}
{\infer[dec]
{\langle x - 1, [x:2] \rangle \to 1}
{\infer[num]
{\langle 1, [x:2] \rangle \to 1}
{}
&
\infer[var]
{\langle x, [x:2] \rangle \to 2}
{}}}
&
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:1] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:1] \rangle \to false}
{\infer[var]
{\langle x, [x:1] \rangle \to 1}
{}
&
\infer[num]
{\langle 1, [x:1] \rangle \to 1}
{}}}}}\]
\end{landscape}\end{document}
答案1
我想为这个问题添加一个答案,我意识到将校样居中的方法之一是调整 pdf 文件的大小。
我有一些规则,需要使用证明包来实现我的结果。
解决方案基本上是删除包lscape
并使用 latex 指令来调整 pdf 的大小,如下pdfpagewidth
所示pdfpageheight
所以解决方案是以下代码
% auto generate file, please not modify the content
\documentclass[10pt]{article}
\usepackage{proof}
% \usepackage{lscape}
\pdfpagewidth=800mm
\pdfpageheight=150mm
\begin{document}
%\begin{landscape}
\centering\[
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:3] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:3] \rangle \to true}
{\infer[var]
{\langle x, [x:3] \rangle \to 3}
{}
&
\infer[num]
{\langle 1, [x:3] \rangle \to 1}
{}}
&
\infer[assign]
{\langle x := x - 1, [x:3] \rangle \to [x:2]}
{\infer[dec]
{\langle x - 1, [x:3] \rangle \to 2}
{\infer[num]
{\langle 1, [x:3] \rangle \to 1}
{}
&
\infer[var]
{\langle x, [x:3] \rangle \to 3}
{}}}
&
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:2] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:2] \rangle \to true}
{\infer[var]
{\langle x, [x:2] \rangle \to 2}
{}
&
\infer[num]
{\langle 1, [x:2] \rangle \to 1}
{}}
&
\infer[assign]
{\langle x := x - 1, [x:2] \rangle \to [x:1]}
{\infer[dec]
{\langle x - 1, [x:2] \rangle \to 1}
{\infer[num]
{\langle 1, [x:2] \rangle \to 1}
{}
&
\infer[var]
{\langle x, [x:2] \rangle \to 2}
{}}}
&
\infer[while]
{\langle while (x > 1) do (x := x - 1), [x:1] \rangle \to [x:1]}
{\infer[gt]
{\langle x > 1, [x:1] \rangle \to false}
{\infer[var]
{\langle x, [x:1] \rangle \to 1}
{}
&
\infer[num]
{\langle 1, [x:1] \rangle \to 1}
{}}}}}\]
%\end{landscape}
\end{document}