1

I would like to use the semantic package to write inference rules, and I would also like to use the proof-at-the-end package to put proofs of my theorems in the appendix. However, when I use these two packages together, it seems that I can no longer properly use the first argument of a macro. Here is an example with the \frac macro:

\documentclass{article}
\usepackage{amsthm}
\usepackage{proof-at-the-end}
\usepackage{semantic}
\newtheorem{thm}{Theorem}
\begin{document}
\begin{theoremEnd}{thm}
  $2 = \frac{4}{2}$.
\end{theoremEnd}
\begin{proofEnd}
  Because of the rule
  \[ \inference{bc \neq 0}{\frac{a}{b} = \frac{ac}{bc}} \]
  we can conclude that $2 = \frac{4}{2}$.
\end{proofEnd}
\printProofs
\end{document}

compilation of the above LaTeX code, with issue described below

As shown in the screenshot, the equation $2 = \frac{4}{2}$ appears correct in the statement of the theorem, but in the proof, the numerator is pushed into the denominator, and the denominator is pushed to the right of the fraction, as if I had written $2 = \frac{}{4}2$ instead.

If I remove the semantic package and \inference rule, both fractions are rendered correctly. The issue also disappears if I remove the proof-at-the-end package and the \printProofs macro, and replace the theoremEnd and proofEnd environments with thm and proof respectively.

How can I use both these packages simultaneously, to appendicize proofs containing inference rules?

1 Answer 1

0

After compiling, take a look at the contents of the generated file pratenddefaultcategory.tex:

\label{proofsection:prAtEndii}\begin{proof}[Proof of \autoref{thm:prAtEndii}]\phantomsection\label{proof:prAtEndii}Because of the rule \[ \inference {bc \neq 0}{\frac {a}{b} = \frac {ac}{bc}} \] we can conclude that $2 = \frac {4}{2}$.\end{proof}

As you can see, the proof-at-the-end package is inserting spaces between macros and their arguments. Normally this shouldn't matter, but the shorthand feature of the semantic package causes this spacing to behave a bit differently:

\documentclass{article}
\usepackage[shorthand]{semantic}
\begin{document}
$\frac {4}{2} = \frac {4}{2}$
\end{document}

compilation of the above LaTeX code, showing the left fraction right and the right fraction wrong

Because proof-at-the-end does not modify the whitespace in your theorem statement, the fraction is rendered correctly there.

This smaller example makes use of the semantic package options:

There is two ways of loading the semantic package. You can either load it with all the parts, or to save time and space, you can load, only the parts you will use.

In the first case you just include

\usepackage{⟨semantic⟩}

in your document preamble.

In the other case you include

\sepackage[⟨parts⟩]{⟨semantic⟩}

in your document preamble. ⟨parts⟩ is a comma separated list of the parts you wants to include. The possibilities are: ligature, inference, tdiagram, reserved, and shorthand.

Thus, assuming you don't need to use the shorthand features, you can resolve your issue by replacing this line in your code

\usepackage{semantic}

with the following line:

\usepackage[inference]{semantic}

compilation of the LaTeX code from the original question, with the issue fixed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.