2

This post is a direct extension of this one. How can I define a proof environment with a different typeset name than "Proof" in a non-English document in addition to the original proof environment, rather than in lieu of it?

The language I am interested in is Hebrew, and the LaTeX language support I use is provided by the polyglossia package in tandem with the xelatex engine, but I'm also interested in the combination babel + lualatex.

Following is a LaTeX document, saved as ~/test.tex, as a starting point.

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{משפט}

\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setmainfont{Arial}
\begin{document}

Following is an interesting theorem.
\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}

\end{document}

When the following instructions are executed in the Terminal:

> cd ~
> xelatex test

the file ~/test.pdf is created. When opened in a PDF viewer, the file displays as follows.

A basic framework for a mathematical paper in Hebrew.

Note that Hebrew is a right-to-left language.

The desired solution would enable me to add the following to ~\test.tex immediately below the \end{proof} line:

\begin{explanation}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{explanation}

with the resulting PDF file displaying like this:

Desired output

Note that the desired output can be accomplished on an ad-hoc basis by adding the option [הסבר] to the proof environment, thus: \begin{proof}[הסבר] ... \end{proof}. However, I'm looking for a solution that would enable me to declare a new environment with a different name than proof.

4
  • Just the name or also the direction? I’m not sure what’s the desired output. Nov 13, 2022 at 8:35
  • The desired output is that if you add under the \end{proof} a copy of the \begin{proof} ... \end{proof} part, but change the two occurrences of the word proof into explanation, the new PDF document would look similar to the one shown above with the difference that under the proof there'll be another proof that would look almost the same as the one above it, except that the first (i.e. right-most) word won't be "הוכחה" but rather "הסבר".
    – Evan Aad
    Nov 13, 2022 at 8:39
  • @JavierBezos I have expanded my post by elaborating on, and exemplifying, the desired solution.
    – Evan Aad
    Nov 13, 2022 at 8:46
  • 1
    @EvanAad I added a perhaps simpler approach.
    – egreg
    Nov 13, 2022 at 11:31

3 Answers 3

3

You want to add to \captions<language>.

\documentclass{article}
\usepackage{polyglossia}
\usepackage{amsthm}

\setmainlanguage{hebrew}
\setotherlanguage{english}
\setmainfont{Arial}

\newtheorem{theorem}{\theoremname}
\newenvironment{explanation}
  {\let\proofname\explanationname\begin{proof}}%
  {\end{proof}}

\newcommand{\theoremname}{Theorem}% default
\newcommand{\explanationname}{Explanation}% default
\appto{\captionshebrew}{%
  \renewcommand\theoremname{משפט}%
  \renewcommand\explanationname{הסבר}%
}
\appto{\captionsenglish}{%
  \renewcommand\theoremname{Theorem}%
  \renewcommand\explanationname{Explanation}%
}

\begin{document}

Following is an interesting theorem.

\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}

\selectlanguage{english}

\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}

\end{document}

enter image description here

A slightly different approach, perhaps simpler.

\documentclass{article}
\usepackage{polyglossia}
\usepackage{amsthm}

\setmainlanguage{hebrew}
\setotherlanguage{english}
\setmainfont{Arial}

\newcommand{\theoremname}{Theorem}% default
\newcommand{\explanationname}{Explanation}% default
\appto{\captionshebrew}{%
  \renewcommand\theoremname{משפט}%
  \renewcommand\explanationname{הסבר}%
}
\appto{\captionsenglish}{%
  \renewcommand\theoremname{Theorem}%
  \renewcommand\explanationname{Explanation}%
}

\newtheorem{theorem}{\theoremname}

\NewDocumentEnvironment{explanation}{o}
 {\IfNoValueTF{#1}{\proof[\explanationname]}{\proof[#1]}}
 {\endproof}

\begin{document}

Following is an interesting theorem.

\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}
\begin{explanation}[הסבר נוסף]
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}

\selectlanguage{english}

\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}
\begin{explanation}[Further explanation]
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}

\end{document}

enter image description here

3

And for babel with either luatex or (with a minimal change) xetex:

\documentclass{article}

\usepackage{amsthm}
\newtheorem{theorem}{\theoremname}

\newenvironment{explanation}%
   {\renewcommand\proofname{\explanationname}%
    \begin{proof}}
   {\end{proof}}

% For LuaTeX. For XeTeX use bidi=bidi
\usepackage[bidi=basic, english, hebrew, provide=*]{babel}
\babelfont{rm}{FreeSans}

\setlocalecaption{hebrew}{theorem}{משפט}
\setlocalecaption{hebrew}{explanation}{הסבר}
\setlocalecaption{english}{theorem}{Theorem}
\setlocalecaption{english}{explanation}{Explanation}

\begin{document}

Following is an interesting theorem.
\begin{theorem}
  A house is not a home.
\end{theorem}
\begin{proof}
  A chair is still a chair, even when there's no one sitting there.
  But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
  A chair is still a chair, even when there's no one sitting there.
  But a chair is not a house, and a house is not a home.
\end{explanation}

\selectlanguage{english}

Following is an interesting theorem.
\begin{theorem}
  A house is not a home.
\end{theorem}
\begin{proof}
  A chair is still a chair, even when there's no one sitting there.
  But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
  A chair is still a chair, even when there's no one sitting there.
  But a chair is not a house, and a house is not a home.
\end{explanation}

\end{document}

enter image description here

2

The following solution is based on Mico's answer to my other question. However, this solution falls short for a bilingual document in which one wants the explanation environment to be language-sensitive the way the proof environment is language-sensitive.

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{משפט}

% The following is based on Mico's answer here:
% https://tex.stackexchange.com/a/664972/21685
% BEGIN
\newcommand\explanationname{Explanation} % could be made language-dependent
\newenvironment{explanation}%
   {\begingroup
    \renewcommand\proofname\explanationname%
    \begin{proof}[הסבר]}%
   {\end{proof}%
    \endgroup}
% END

\usepackage{polyglossia}
\setmainlanguage{hebrew}
\setmainfont{Arial}
\begin{document}

Following is an interesting theorem.

\begin{theorem}
A house is not a home.
\end{theorem}
\begin{proof}
   A chair is still a chair, even when there's no one sitting there.
   But a chair is not a house, and a house is not a home.
\end{proof}
\begin{explanation}
   When there's no one there to hold you tight,
   and no one there you can kiss goodnight,
   a house is not a home.
\end{explanation}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .