를 사용하면 \syllogC
삼단논법 패키지에서 사용자가 삼단논법에 대한 자동 번호 계산을 포함합니다.
\syllogC{Every man is mortal} %
{Socrates is a man} %
{Socrates is mortal}
다음과 비슷한 것을 생성합니다.
(S1) 모든 사람은 죽는다. 소크라테스는 남자입니다. 소크라테스는 죽는다.
나는 사용자가 삼단논법의 각 구성 요소에 대한 자동 계산 기능의 이점을 누릴 수 있다고 생각합니다.
(S1) A. 모든 사람은 죽는다. B. 소크라테스는 사람이다. C. 소크라테스는 죽는다.
이렇게 하면 사용자는 삼단논법 전체뿐 아니라 그 내부의 각 부분도 쉽게 참조할 수 있습니다.
예: (S1)에서 볼 수 있듯이 전제(S1A)와 전제(S1B)로부터 결론(S1C)이 도출됩니다.
이러한 보조 카운터를 구현하는 가장 좋은 코드는 무엇입니까?
MWE:
\documentclass[letterpaper,
10pt,
]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{syllogism}
\begin{document}
\def\preA{All men except Socrates are able to laugh}
\def\preB{Socrates is a man}
\def\Conc{Socrates is not able to laugh}
\syllogC{\preA}{\preB}{\Conc}
\end{document}
답변1
새로운 카운터를 사용할 필요가 없습니다(어려울 수도 있습니다).
\@sylloc
나는 또 다른 접근법을 사용했는데, 명령 의 목록을 어쨌든 카운터를 제공하는 sylloglist
의 복제본인 특수 항목으로 대체했습니다.enumerate
세 번째 항목은 입니다 . 거기 로 rule
바꿔야 합니다 . 목록 간격 설정이 의 선택적 인수에 통합되었습니다 .\item ...
\item[]
sylloglist
\documentclass[letterpaper, 10pt,]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{enumitem}
\usepackage{xpatch}
\usepackage{syllogism}
\newlist{sylloglist}{enumerate}{1}
\setlist[sylloglist,1]{label={\Alph*},ref={(S\csname thec:syl\endcsname\Alph*)}}
\makeatletter
\xpatchcmd{\@syllog}{%
\begin{list}{}
{%
\setlength{\parsep}{\z@}
\setlength{\itemsep}{\z@}
\addtolength{\leftmargin}{-1.5em}
\setlength{\itemindent}{-1ex}
\setlength{\listparindent}{\itemindent}
}
}{%
\begin{sylloglist}[parsep=\z@,itemsep=\z@,leftmargin={\dimexpr\leftmargin-1.5em},itemindent=-1ex,listparindent=\itemindent]
}{\typeout{Patching startup of list succeeded}}{\typeout{Patching startup of list failed}}
\xpatchcmd{\@syllog}{%
\item \rule{\SY@LenRule}{\SY@HiRule}
}{%
\item[] \rule{\SY@LenRule}{\SY@HiRule}
}{\typeout{Patching rule item of list succeeded}}{\typeout{Patching rule item of list failed}}
\xpatchcmd{\@syllog}{%
\end{list}
}{\end{sylloglist}}{\typeout{Patching end of list succeeded}}{\typeout{Patching end of list failed}}
\makeatother
\begin{document}
\def\preA{All men except Socrates are able to laugh\label{first}}
\def\preB{Socrates is a man\label{second}}
\def\Conc{Socrates is not able to laugh\label{conclusion}}
\syllogC{\preA}{\preB}{\Conc}
\def\preA{All men except Socrates are able to laugh\label{firstnew}}
\def\preB{Socrates is a man\label{secondnew}}
\def\Conc{Socrates is not able to laugh\label{conclusionnew}}
\syllogC{\preA}{\preB}{\Conc}
In \ref{conclusion} we found that ... whereas in \ref{conclusionnew} it was shown that ...
The statement \ref{first} is the same as \ref{firstnew}
\end{document}
답변2
패키지 의 접근 방식은 syllogism
그다지 설득력이 없습니다. 그러나 일부 패치를 사용하면 필요한 것을 얻을 수 있습니다.
전체 삼단논법에 대한 는 \label
예와 같이 그 뒤에 배치되어야 하는 반면, 단일 항목에 대한 레이블은 그 안에 들어가야 합니다.
\documentclass[letterpaper,
10pt,
]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{syllogism}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@syllog}
{\settowidth}
{\setcounter{sylitem}{0}\settowidth}
{}{}
\patchcmd{\@syllog}
{\setlength{\SY@availSpace}}
{\setcounter{sylitem}{0}\setlength{\SY@availSpace}}
{}{}
\patchcmd{\syllogC}{\stepcounter}{\refstepcounter}{}{}
\setcounter{c:syl}{1}
\newcounter{sylitem}
\renewcommand{\thesylitem}{\Alph{sylitem}\closeparenref}
\renewcommand{\p@sylitem}{\openparenref S\arabic{c:syl}}
\newcommand{\syllogD}[3]{%
\syllogC{\sylitem #1}{\sylitem #2}{\sylitem #3}%
}
\newcommand{\sylitem}{\refstepcounter{sylitem}\thesylitem.~}
\@namedef{thec:syl}{S\the\numexpr\arabic{c:syl}-1\relax\closeparenref}
\@namedef{p@c:syl}{\openparenref}
\protected\def\openparenref#1\closeparenref{\textup{(#1)}}
\protected\def\closeparenref{}
\makeatother
\begin{document}
\def\preA{All men except Socrates are able to laugh}
\def\preB{Socrates is a man}
\def\Conc{Socrates is not able to laugh}
\syllogD{\preA\label{syl1A}}{\preB\label{syl1B}}{\Conc\label{syl1C}}\label{syl1}
\syllogD{\preA\label{syl2A}}{\preB\label{syl2B}}{\Conc\label{syl2C}}\label{syl2}
\ref{syl1}--\ref{syl1A}--\ref{syl1B}--\ref{syl1C}
\ref{syl2}--\ref{syl2A}--\ref{syl2B}--\ref{syl2C}
\end{document}
독립적인 구현.
\documentclass{article}
\usepackage{booktabs,xparse,amssymb}
\ExplSyntaxOn
\keys_define:nn { syllogism }
{
number .bool_set:N = \l_syllogism_number_bool,
number .default:n = true,
label .tl_set:N = \l_syllogism_label_tl,
subnumber .bool_set:N = \l_syllogism_subnumber_bool,
subnumber .default:n = true,
first-premiss .tl_set:N = \l_syllogism_first_tl,
first-premiss .value_required:n = true,
second-premiss .tl_set:N = \l_syllogism_second_tl,
second-premiss .value_required:n = true,
conclusion .tl_set:N = \l_syllogism_concl_tl,
conclusion .value_required:n = true,
}
\NewDocumentCommand{\sylref}{m}{\textup{(\ref{#1})}}
\NewDocumentCommand{\syllogism}{m}
{
\setcounter{syllogismitem}{0}
\group_begin:
\keys_set:nn { syllogism } { #1 }
\bool_if:NT \l_syllogism_number_bool
{
\refstepcounter{syllogism}
\tl_if_blank:VF \l_syllogism_label_tl { \label { \l_syllogism_label_tl } }
(\thesyllogism)\qquad
}
\begin{tabular}{@{}l}
\bool_if:NT \l_syllogism_subnumber_bool
{
\refstepcounter{syllogismitem}
\thesyllogismitem.~
}
\l_syllogism_first_tl
\\
\bool_if:NT \l_syllogism_subnumber_bool
{
\refstepcounter{syllogismitem}
\thesyllogismitem.~
}
\l_syllogism_second_tl
\\
\midrule
\bool_if:NT \l_syllogism_subnumber_bool
{
\refstepcounter{syllogismitem}
\thesyllogismitem.~
}
\l_syllogism_concl_tl \qquad $\therefore$
\end{tabular}
\group_end:
}
\ExplSyntaxOff
\NewDocumentCommand{\openparenref}{u\closeparenref}{\textup{(#1)}}
\NewDocumentCommand{\closeparenref}{}{}
\makeatletter
\newcounter{syllogism}
\renewcommand{\thesyllogism}{S\arabic{syllogism}\closeparenref}
\renewcommand{\p@syllogism}{\openparenref}
\newcounter{syllogismitem}
\renewcommand{\thesyllogismitem}{\Alph{syllogismitem}\closeparenref}
\renewcommand{\p@syllogismitem}{\openparenref S\arabic{syllogism}}
\makeatother
\begin{document}
\syllogism{
number,
label=syl1,
subnumber,
first-premiss={All men except Socrates are able to laugh\label{syl1A}},
second-premiss={Socrates is a man\label{syl1B}},
conclusion={Socrates is not able to laugh\label{syl1C}},
}
\bigskip
\syllogism{
number,
label=syl2,
first-premiss={Mus syllaba est},
second-premiss={Syllaba autem caseum non rodit},
conclusion={Ergo mus caseum non rodit},
}
\bigskip
\syllogism{
first-premiss={Mus syllaba est},
second-premiss={Mus autem caseum rodit},
conclusion={Ergo syllaba caseum rodit},
}
\bigskip
References:
\ref{syl1}--\ref{syl1A}--\ref{syl1B}--\ref{syl1C}
\ref{syl2}
\end{document}
삼단논법에서 지나치게 긴 항목을 분리할 수 있는 변형입니다. 새 키가 maxwidth
추가되었습니다(기본값 \linewidth
). 항목을 여러 줄로 나누어야 하는 경우 항목의 여백에 라벨이 붙어 있습니다(물론 하위 번호 매기기가 활성화된 경우).
\documentclass{article}
\usepackage{booktabs,xparse,amssymb,varwidth,showframe}
\ExplSyntaxOn
\keys_define:nn { syllogism }
{
number .bool_set:N = \l_syllogism_number_bool,
number .default:n = true,
label .tl_set:N = \l_syllogism_label_tl,
subnumber .bool_set:N = \l_syllogism_subnumber_bool,
subnumber .default:n = true,
first-premiss .tl_set:N = \l_syllogism_first_tl,
first-premiss .value_required:n = true,
second-premiss .tl_set:N = \l_syllogism_second_tl,
second-premiss .value_required:n = true,
conclusion .tl_set:N = \l_syllogism_concl_tl,
conclusion .value_required:n = true,
maxwidth .dim_set:N = \l_syllogism_maxwidth_dim
}
\NewDocumentCommand{\syllogism}{m}
{
\setcounter{syllogismitem}{0}
\group_begin:
\keys_set:nn { syllogism } { maxwidth=\linewidth, #1 }
\tl_put_right:Nn \l_syllogism_concl_tl { \unskip \nolinebreak\qquad $\therefore$ }
\noindent
\bool_if:NT \l_syllogism_number_bool
{
\refstepcounter{syllogism}
\tl_if_blank:VF \l_syllogism_label_tl { \label { \l_syllogism_label_tl } }
\makebox[3em][l]{(\thesyllogism)}
}
\begin{tabular}{@{}l}
\syllogism_make_text:V \l_syllogism_first_tl
\\
\syllogism_make_text:V \l_syllogism_second_tl
\\
\midrule
\syllogism_make_text:V \l_syllogism_concl_tl
\end{tabular}
\group_end:
}
\cs_new_protected:Nn \syllogism_make_text:n
{
\begin{varwidth}
{
\dim_eval:n
{
\l_syllogism_maxwidth_dim
\bool_if:NT \l_syllogism_number_bool { - 3em }
- \tabcolsep
}
}
\bool_if:NT \l_syllogism_subnumber_bool
{
\leftskip=1.5em
\refstepcounter{syllogismitem}
\makebox[0pt][r]{\makebox[1.5em][l]{\thesyllogismitem.}}
}
\ignorespaces
#1
\end{varwidth}
}
\cs_generate_variant:Nn \syllogism_make_text:n { V }
\ExplSyntaxOff
\NewDocumentCommand{\openparenref}{u\closeparenref}{\textup{(#1)}}
\NewDocumentCommand{\closeparenref}{}{}
\makeatletter
\newcounter{syllogism}
\renewcommand{\thesyllogism}{S\arabic{syllogism}\closeparenref}
\renewcommand{\p@syllogism}{\openparenref}
\newcounter{syllogismitem}
\renewcommand{\thesyllogismitem}{\Alph{syllogismitem}\closeparenref}
\renewcommand{\p@syllogismitem}{\openparenref S\arabic{syllogism}}
\makeatother
\begin{document}
\syllogism{
number,
label=syl1,
subnumber,
first-premiss={All men except Socrates are able to laugh\label{syl1A}},
second-premiss={Socrates is a man\label{syl1B}},
conclusion={Socrates is not able to laugh\label{syl1C}},
}
\bigskip
\syllogism{
number,
label=syl2,
first-premiss={Mus syllaba est},
second-premiss={Syllaba autem caseum non rodit},
conclusion={Ergo mus caseum non rodit},
}
\bigskip
\syllogism{
first-premiss={Mus syllaba est},
second-premiss={Mus autem caseum rodit},
conclusion={Ergo syllaba caseum rodit},
}
\bigskip
\syllogism{
number,
label=syl3,
subnumber,
first-premiss={
All men except Socrates are able to laugh
All men except Socrates are able to laugh
All men except Socrates are able to laugh
All men except Socrates are able to laugh\label{syl3A}
},
second-premiss={Socrates is a man\label{syl3B}},
conclusion={Socrates is not able to laugh\label{syl3C}},
}
\bigskip
References:
\ref{syl1}--\ref{syl1A}--\ref{syl1B}--\ref{syl1C}
\ref{syl2}
\end{document}