![LateX 中的三段论,三段论包对齐问题?](https://linux22.com/image/396436/LateX%20%E4%B8%AD%E7%9A%84%E4%B8%89%E6%AE%B5%E8%AE%BA%EF%BC%8C%E4%B8%89%E6%AE%B5%E8%AE%BA%E5%8C%85%E5%AF%B9%E9%BD%90%E9%97%AE%E9%A2%98%EF%BC%9F.png)
有人有办法在 LateX 中编写逐行三段论吗?最好在旁边加上注释?
我尝试过三段论包,但是前提下的对齐方式关闭了。具体来说,结论之前的水平线向右移动,并且前提和结论水平线之间的间距异常。这只在我使用较短的文本“A 是 B”等命题时才会出现。
生成代码:
\documentclass{article}
\usepackage{syllogism}
\begin{document}
\syllog{Every man except Socrates is musician} %
{Socrates is a man} %
{Socrates is not a musician},
\syllog{A is B} %
{B is C} %
{A is C},
\syllog[(S1)]{A is B} %
{B is C} %
{A is C},
\end{document}
目前,我正在使用 bussproofs 包,但它不支持将每个前提放在自己的一行上。所有前提最终都放在一行上,如下所示。我希望使用三段论包的行为,但要解决对齐问题。
\usepackage{bussproofs}
\begin{prooftree}
\AxiomC{MaN}
\AxiomC{MoX}
\BinaryInfC{NoX}
\end{prooftree}
\begin{prooftree}
\AxiomC{M belongs to all N}
\AxiomC{No M belongs to some X}
\BinaryInfC{No N belongs to some X}
\end{prooftree}
任何指导都值得感激。此外,任何能更好地涵盖这一点的标签建议也值得感激。
谢谢!
答案1
很难理解如何syllogism
设置各种维度的方式,正如您所发现的,这会产生非常奇怪的后果。
这是对宏的彻底重新实现\syllog
。三段论永远不会超过当前列宽减去两倍“预空间”。在最后的“因此”符号之前不允许换行。
\documentclass{article}
\usepackage{xfp}
\usepackage{showframe}
\usepackage{syllogism}
\makeatletter
\def\@syllog[#1]#2#3#4{%
% Define the propositions -----------------------------------------------
\def\@SYLpropA{\ignorespaces#2\unskip}%
\def\@SYLpropB{\ignorespaces#3\SY@PuncPB\unskip}%
\def\@SYLpropC{\ignorespaces#4\unskip\nolinebreak\hspace{\SY@SpConEG}\SY@ErgoSign}%
%
\settowidth{\SY@LenPA}{\@SYLpropA}
\settowidth{\SY@LenPB}{\@SYLpropB}
\settowidth{\SY@LenC}{\@SYLpropC}
%
\setlength{\SY@LenLab}{\widthof{#1}}%
\ifdim\SY@LenLab>\z@
\addtolength{\SY@LenLab}{\SY@SpLabel}
\fi
%
% Set the rule's length ----------------------------------------------
\setlength{\SY@LenRule}{%
\fpeval{max(\SY@LenPA,\SY@LenPB,\SY@LenC)}pt}%
\ifdim\dimexpr\SY@LenRule+\SY@Pre+\SY@LenLab\relax>\dimexpr\columnwidth-\SY@Pre\relax
\setlength{\SY@LenRule}{\columnwidth-2\SY@Pre-\SY@LenLab}%
\fi
% Construction of the Syllogism ----------------------------------------
\par\vspace{\SY@LenSepA}\noindent % V-space before the syllogism
\if@SYParam % Conditional H-space before syllogism
\hspace{\SY@Pre}#1\hspace{\SY@SpLabel}%
\else
\hspace{\SY@Pre}%
\fi
%
\begin{minipage}{\SY@LenRule}
\raggedright
\begin{list}{}
{%
\setlength{\parsep}{\z@}%
\setlength{\itemsep}{\z@}%
\setlength{\leftmargin}{1em}%
\setlength{\itemindent}{-\leftmargin}%
\setlength{\labelwidth}{0pt}%
\setlength{\labelsep}{0pt}%
}
\item \@SYLpropA
\item \@SYLpropB\vspace{\dimexpr-\ht\strutbox+\dp\strutbox}
\item \rule{\SY@LenRule}{\SY@HiRule}
\item \@SYLpropC
\end{list}
\end{minipage}
\par\vspace{\SY@LenSepB}% V-space after the syllogism
%
\@SYRestoreBooleans% Restore booleans
}
\makeatletter
\begin{document}
\syllog{Every man except Socrates is musician}
{Socrates is a man}
{Socrates is not a musician}
\syllog{Every man except Socrates is musician Every man except Socrates is musician}
{Socrates is a man}
{Socrates is not a musician}
\syllog{A is B}
{B is C}
{A is C}
\syllog[(S1)]{A is B}
{B is C}
{A is C}
\end{document}
该showframe
包仅用于显示文本块的边距。
如果您也使用该\syllogTA
命令,则需要进行其他更改。