我正在尝试使我的文档tglat2e
适应本期刊。请看一下这个 MWE:
\documentclass{tglat2e}
\let\proof\relax
\let\endproof\relax
%This trick is due to David Carlisle's answer to question number 43835. It fixes some issues.
\usepackage{amsthm}
\usepackage{caption}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\begin{document}
\title{Example}
\authors{Mr.~No
\address Department of Mathematics
\email email}
\maketitle
\begin{abstract}
Abstract
\end{abstract}
\section{Introduction}
\begin{proof}
Proof.
\begin{proof}[Proof of Lemma]
\[
E=mc^2\qedhere
\]
%The \qedhere command does not work at all.
\end{proof}
The qed appears because it is called. With the fix, it appears now twice.\qed
\end{proof}
\begin{proof}
Here is a proof. But the qed-symbol does not occur automatically.
\end{proof}
\begin{table}[ht]
\centering
\caption{This is a caption which\\
goes over two lines.}
\end{table}
\end{document}
本文档编译后会抛出四个错误和一个警告。这些错误都与似乎与期刊风格相冲突的呈现有关
amsthm
。显而易见的建议是:不要加载amsthm
!但这会在我的原始文档中产生大约 500 个错误和警告。我该如何摆脱这些错误?该警告与 -package 有关
caption
。我只需要此包来处理示例中的带换行符的标题。我该如何实现此效果?此问题已修复。此修复还解决了第一项中的一个错误。证明环境不像我习惯的那样工作。它不会自动生成 qed 符号,而只会在调用一次后生成。此外,它
\qedhere
根本不起作用。
如果你能帮助我,我会非常高兴。谢谢!
其余错误和警告如下,供您参考:
LaTeX Error: Command \theoremstyle already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.57 }
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
LaTeX Error: Command \newtheoremstyle already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.263 }
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
LaTeX Error: Command \openbox already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.417 \vrule\hfil}}
Your command was ignored.
Type I <command> <return> to replace it with another command,
or <return> to continue without it.
Package caption Warning: Unsupported document class (or package) detected, usage of the caption package is not recommended. See the caption package documentation for explanation.
答案1
包含tglat2e.cls
了的大部分内容amsthm.sty
,但删除了对 QED 符号的任何引用。
恢复起来并不难,只要粘贴相关的宏就可以了。
\documentclass{tglat2e}
\usepackage{amsmath}
%\usepackage{caption}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\makeatletter
\DeclareRobustCommand{\qed}{%
\ifmmode \mathqed
\else
\leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
\quad\hbox{\qedsymbol}%
\fi
}
\let\QED@stack\@empty
\let\qed@elt\relax
\newcommand{\pushQED}[1]{%
\toks@{\qed@elt{#1}}\@temptokena\expandafter{\QED@stack}%
\xdef\QED@stack{\the\toks@\the\@temptokena}%
}
\newcommand{\popQED}{%
\begingroup\let\qed@elt\popQED@elt \QED@stack\relax\relax\endgroup
}
\def\popQED@elt#1#2\relax{#1\gdef\QED@stack{#2}}
\newcommand{\qedhere}{%
\begingroup \let\mathqed\math@qedhere
\let\qed@elt\setQED@elt \QED@stack\relax\relax \endgroup
}
\renewenvironment{proof}[1][\proofname]{\par
\pushQED{\qed}%
\normalfont \topsep6\p@\@plus6\p@\relax
\trivlist
\item[\hskip\labelsep
\itshape
#1\@addpunct{.}]\ignorespaces
}{%
\popQED\endtrivlist\@endpefalse
}
\def\setQED@elt#1#2\relax{%
\ifmeasuring@
\else \iffirstchoice@ \gdef\QED@stack{\qed@elt{}#2}\fi
\fi
#1%
}
\def\qed@warning{%
\PackageWarning{amsthm}{The \@nx\qedhere command may not work
correctly here}%
}
\newcommand{\mathqed}{\quad\hbox{\qedsymbol}}
\def\linebox@qed{\hfil\hbox{\qedsymbol}\hfilneg}
\@ifpackageloaded{amsmath}{%
\def\math@qedhere{%
\@ifundefined{\@currenvir @qed}{%
\qed@warning\quad\hbox{\qedsymbol}%
}{%
\@xp\aftergroup\csname\@currenvir @qed\endcsname
}%
}
\def\displaymath@qed{%
\relax
\ifmmode
\ifinner \aftergroup\linebox@qed
\else
\eqno
\let\eqno\relax \let\leqno\relax \let\veqno\relax
\hbox{\qedsymbol}%
\fi
\else
\aftergroup\linebox@qed
\fi
}
\@xp\let\csname equation*@qed\endcsname\displaymath@qed
\def\equation@qed{%
\iftagsleft@
\hbox{\phantom{\quad\qedsymbol}}%
\gdef\alt@tag{%
\rlap{\hbox to\displaywidth{\hfil\qedsymbol}}%
\global\let\alt@tag\@empty
}%
\else
\gdef\alt@tag{%
\global\let\alt@tag\@empty
\vtop{\ialign{\hfil####\cr
\tagform@\theequation\cr
\qedsymbol\cr}}%
\setbox\z@
}%
\fi
}
\def\qed@tag{%
\global\tag@true \nonumber
&\omit\setboxz@h {\strut@ \qedsymbol}\tagsleft@false
\place@tag@gather
\kern-\tabskip
\ifst@rred \else \global\@eqnswtrue \fi \global\advance\row@\@ne \cr
}
\def\split@qed{%
\def\endsplit{\crcr\egroup \egroup \ctagsplit@false \rendsplit@
\aftergroup\align@qed
}%
}
\def\align@qed{%
\ifmeasuring@ \tag*{\qedsymbol}%
\else \let\math@cr@@@\qed@tag
\fi
}
\@xp\let\csname align*@qed\endcsname\align@qed
\@xp\let\csname gather*@qed\endcsname\align@qed
%% Needs some patching up for amsmath 1.2
}{% end of amsmath branch, start plain LaTeX branch
\def\math@qedhere{%
\@ifundefined{\@currenvir @qed}{%
\qed@warning \aftergroup\displaymath@qed
}{%
\@xp\aftergroup\csname\@currenvir @qed\endcsname
}%
}
\def\displaymath@qed{%
\relax
\ifmmode
\ifinner \aftergroup\aftergroup\aftergroup\linebox@qed
\else
\eqno \def\@badmath{$$}%
\let\eqno\relax \let\leqno\relax \let\veqno\relax
\hbox{\qedsymbol}%
\fi
\else
\aftergroup\linebox@qed
\fi
}
\@ifundefined{[email protected]}{%
\def\equation@qed{\displaymath@qed \quad}%
}{%
\def\equation@qed{\displaymath@qed}%
}
\def\@tempa#1$#2#3\@nil#4{%
\def#4{#1$#2\def\@currenvir{displaymath}#3}%
}%
\expandafter\ifx\csname[ \endcsname\relax
\expandafter\@tempa\[\@nil\[%
\else
\expandafter\expandafter\expandafter\@tempa\csname[
\expandafter\endcsname\expandafter\@nil
\csname[ \endcsname
\fi
}
\makeatother
\begin{document}
\title{Example}
\authors{Mr.~No
\address Department of Mathematics
\email email}
\maketitle
\begin{abstract}
Abstract
\end{abstract}
\section{Introduction}
\begin{proof}
Proof.
\begin{proof}[Proof of Lemma]
\begin{equation*}
E=mc^2\qedhere
\end{equation*}
%The \qedhere command does not work at all.
\end{proof}
The qed appears because it is called. With the fix, it appears now twice.
\end{proof}
\begin{proof}
Here is a proof. But the qed-symbol does not occur automatically.
\end{proof}
\end{document}
你不能使用该caption
包,也不能手动将标题分成两行,除非其中一行的长度超过\@maxcaptionwd
。
\caption[This is a caption]{\makebox[\csname @maxcaptionwd\endcsname][l]{This is a caption which}\\
goes over two lines.}
可选参数显然是必要的。
笔记您的手稿有可能被拒绝。