Prostředí bmatrix nedefinováno. \ begin {bmatrix} v Latexu

Používám tento tento formát Springeru latexový dokument a chtěl do dokumentu přidat matici a já už nějakou dobu narážím na tuto chybu.

\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 

Zobrazuje se mi chyba Environment bmatrix undefined. \begin{bmatrix}. Také jsem přidal balíček amsmath, ale zdálo se, že to nepomůže. V čem by mohl být problém?

Komentáře

  • Plus to promění v minimální práci příklad. Soubor TeX by neměl ' mít dva samostatné \documentclass příkazy a zavřete filecontents* prostředí, které se nikdy neotevře. Také, co máte v úmyslu s renewcommand*\env@matrix a renewenvironment{bmatrix}?

Odpověď

Přidal jsem také balíček amsmath, ale zdálo se, že to nepomůže. V čem by mohl být problém?

Pokyny

\usepackage{amsmath, xparse} 

musí dříve v preambuli. Mělo by být provedeno bezprostředně po \usepackage{booktabs} nejpozději .

Proč? Protože preambule pak re definuje makro \env@matrix a prostředí bmatrix. Oba jsou definovány v balíčku amsmath. Není překvapením, že LaTeX selže, pokud je řečeno, že má předefinovat něco, co ještě nebylo definováno.

Napsat komentář

Vaše e-mailová adresa nebude zveřejněna. Vyžadované informace jsou označeny *