我一直在用这个这springer 格式 latex 文档,并想在论文中添加一个矩阵,但一段时间以来我一直遇到这个错误。
\documentclass[a4paper]{article}
\usepackage{pdfpages}
\usepackage{graphicx}
\graphicspath{ {./imgs/} }
\usepackage{changepage}% http://ctan.org/pkg/changepage
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{booktabs}
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
\hskip -\arraycolsep
\let\@ifnextchar\new@ifnextchar
\array{#1}}
\renewenvironment{bmatrix}
{{\ifnum`}=0 \fi\left[\env@matrix}
{\endmatrix\right]\ifnum`{=0 \fi}}
\makeatother
\usepackage{amsmath, xparse}
\usepackage{mathtools}
\newlength{\extratrim}
\setlength{\extratrim}{10mm}
\newcommand*{\trimexpr}[1]{\dimexpr(#1)+\extratrim\relax}
gsave
newpath
20 20 moveto
20 220 lineto
220 220 lineto
220 20 lineto
closepath
2 setlinewidth
gsave
.4 setgray fill
grestore
stroke
grestore
\end{filecontents*}
%
\RequirePackage{fix-cm}
%
%\documentclass{svjour3} % onecolumn (standard format)
%\documentclass[smallcondensed]{svjour3} % onecolumn (ditto)
\documentclass[smallextended]{svjour3} % onecolumn (second format)
%\documentclass[twocolumn]{svjour3} % twocolumn
%
\smartqed % flush right qed marks, e.g. at end of proof
%
\usepackage{graphicx}
%
\usepackage{mathptmx} % use Times fonts if available on your TeX system
%
% insert here the call for the packages your document requires
%\usepackage{latexsym}
% etc.
%
% please place your own definitions here and don't use \def but
% \newcommand{}{}
%
% Insert the name of "your journal" with
% \journalname{myjournal}
%
\begin{document}
\title{Random titl}
\author{me \& him }
\institute{x x of x, \at
Institute of x Technology and Electronics \\
{} % \\
%
\and
x x
x, yy
\and \\
x x
x, yy
}
\date{May 15th 2020}
% The correct dates will be entered by the editor
\maketitle
\[
\begin{bmatrix}
1 2 \\
2 3
\end{bmatrix}
\]
\section{Summary}
\section{Appendix}
%\begin{acknowledgements}
%If you'd like to thank anyone, place your comments here
%and remove the percent signs.
%\end{acknowledgements}
% Authors must disclose all relationships or interests that
% could have direct or potential influence or impart bias on
% the work:
%
% \section*{Conflict of interest}
%
% The authors declare that they have no conflict of interest.
% BibTeX users please use one of
%\bibliographystyle{spbasic} % basic style, author-year citations
%\bibliographystyle{spmpsci} % mathematics and physical sciences
%\bibliographystyle{spphys} % APS-like style for physics
%\bibliography{} % name your BibTeX data base
% Non-BibTeX users please use
\begin{thebibliography}{}
%
% and use \bibitem to create references. Consult the Instructions
% for authors for reference list style.
%
\bibitem{RefJ}
% Format for Journal Reference
Author, Article title, Journal, Volume, page numbers (year)
% Format for books
\bibitem{RefB}
Author, Book title, page numbers. Publisher, place (year)
% etc
\end{thebibliography}
\end{document}
% end of file template.tex
我收到错误Environment bmatrix undefined. \begin{bmatrix}
。我还添加了 amsmath 包,但似乎没有帮助。可能是什么问题?
答案1
我也添加了
amsmath
包,但似乎没有帮助。可能是什么问题?
指令
\usepackage{amsmath, xparse}
不得不较早在序言中。它应在之后立即执行\usepackage{booktabs}
最迟。
为什么?因为序言关于定义宏\env@matrix
和环境bmatrix
。两者都在包中定义amsmath
。毫不奇怪,如果要求 LaTeX 重新定义尚未定义的内容,它就会崩溃。