
我知道如何寫所有符號,但我不知道如何製作矩形並像表格一樣書寫。我使用了這個網頁:https://www.tablesgenerator.com/,但我不喜歡它顯示校樣的方式。
答案1
這是使用環境的解決方案tabular
。為了證明本身程式碼的簡單性,我定義了一些新指令。首先,一個以三列prooftabular
開頭的環境:tabular
- 第一個自動顯示證明的行號(您不必在其中寫入任何內容);
- 第二個自動處於數學模式,被認為用於證明的步驟;
- 第三個是文本模式,被認為用來證明證明步驟的合理性。
此環境可以單獨使用來顯示證明。但是,為了添加角落中帶有符號的框,我定義了其他三個命令:
\hlineproofbox
新增框的水平線\cline{2-2}
。\proofboxed
在框中的儲存格周圍新增垂直線。它將相應單元格的內容作為參數。它只添加帶有 的垂直線\multicolumn{1}{|...|}{...}
。\corner
在角落的上標中加入其參數。它應該放置在第一個\proofboxed{}
.
這三個指令的用處不大,因為它們的內容也可以直接放在表中。我只是覺得這樣證明的程式碼比較容易閱讀。
無論如何,這是一個帶有證明的完整範例。
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\newcounter{proofrow}
\newenvironment{prooftabular}{%
\let\oldarraystretch\arraystretch
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{%
@{\stepcounter{proofrow}\theproofrow}%
p{1em}@{}>{\(}l<{\)}>{\quad}l%
}
}{%
\end{tabular}
\renewcommand{\arraystretch}{\oldarraystretch}
}
\newcommand{\hlineproofbox}{\cline{2-2}}
\newcommand{\proofboxed}[1]{\multicolumn{1}{|>{\(}l<{\)}@{\ }|}{#1}}
\newcommand{\corner}[1]{\qquad {}^{#1}}
\begin{document}
\[
\forall x, P_1^1(x) \implies P_2^1(x), \forall x . P_2^1(x) \implies P_3^1(x) \vdash \forall x . P_1^1(x) \implies P_3^1(x)
\]
\begin{prooftabular}
& \forall x . P_1^1(x) \implies P_2^1(x) & Prem \\
& \forall x . P_2^1(x) \implies P_3^1(x) & Prem \\
\hlineproofbox
& \proofboxed{P_1^1(n) \implies P_2^1(n) \corner{/ \forall n}} & \(E \ \forall 1\) \\
& \proofboxed{P_2^1(n) \implies P_3^1(n)} & \(E \ \forall 2\) \\
& \proofboxed{P_1^1(n) \implies P_3^1(n)} & Teo \(\alpha \implies \beta, \beta \implies \gamma \vdash \alpha \implies \gamma\) \\
\hlineproofbox
& \forall x . P_1^1(x) \implies P_3^1(x) & \(\forall x . P_1^1(x) \implies P_2^1(x), \forall x . P_2^1(x) \implies P_3^1(x)\)
\end{prooftabular}
\end{document}
答案2
假設編寫符號指令沒有問題,那麼您可以使用empheq
package 圍繞一些方程式(為簡單起見,兩個)製作一個框,如下所示:
及其程式碼
\documentclass{article}
\usepackage{amsmath}
\usepackage{empheq}
\begin{document}
%
\begin{empheq}[box=\fbox]{align}
E=mc^2 \\
y=ax+b
\end{empheq}
%
\end{document}
當然,您可以添加星號{align*}
來刪除方程式的編號。
如果你想要方程式在左側編號,你可以使用類別[leqno]
的article
選項,如下所示
有些方程式編號,而有些方程式沒有編號(使用\nonumber
),那麼程式碼可以是
\documentclass[leqno]{article}
\usepackage{amsmath}
\usepackage{empheq}
\begin{document}
%
\begin{empheq}[box=\fbox]{align}
E=mc^2 \\
y=ax+b \\
y_2 = ax+b \nonumber
\end{empheq}
%
\end{document}
嗯,這不是完美的答案。這只是一些我相信其他人可以改進的想法。