![当我使用 tcolorbox 包时,wxmaxima latex 代码给出错误](https://linux22.com/image/280188/%E5%BD%93%E6%88%91%E4%BD%BF%E7%94%A8%20tcolorbox%20%E5%8C%85%E6%97%B6%EF%BC%8Cwxmaxima%20latex%20%E4%BB%A3%E7%A0%81%E7%BB%99%E5%87%BA%E9%94%99%E8%AF%AF.png)
我复制了 wxmaxima 给我的 latex 代码,但出现了 minipage 错误,代码如下:
\documentclass[10pt,a4paper,oneside,spanish]{article}
\usepackage[spanish,es-nodecimaldot]{babel}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{units}
\usepackage{endnotes}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{color,xcolor}
\usepackage[total={15cm,21cm},left=2cm,top=2cm]{geometry}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\newcounter{exe}
\newcommand{\titulo}{
\node[fill=blue!20,
rounded corners,
draw=black,
text=black,
line width=1pt,
inner sep=4pt,
anchor=west,
xshift=12pt]
at (frame.north west){\bfseries Ejercicio \stepcounter{exe}\theexe.};
}
\newtcolorbox{ejercicio}{
enhanced,
overlay unbroken and first={\titulo},
colframe=orange,
boxrule=1pt,
arc=3mm,
breakable,
top=15pt,
before=\vskip18pt,
}
\begin{document}
\begin{ejercicio}
A sample
\end{ejercicio}
\noindent
%%%%%%%%%%%%%%%
%%% INPUT:
\begin{minipage}[t]{8ex}{\color{red}\bf
\begin{verbatim}
(%i1)
\end{verbatim}}
\end{minipage}
\begin{minipage}[t]{\textwidth}{\color{blue}
\begin{verbatim}
divide(x^5-3*x^4+2*x^3-3*x^2+4*x+1,5*x^4-12*x^3+6*x^2-6*x+4,x);
\end{verbatim}}
\end{minipage}
%%% OUTPUT:
\definecolor{labelcolor}{RGB}{100,0,0}
\begin{math}\displaystyle
\parbox{8ex}{\color{labelcolor}\tt{($\!$\%o1)} }
[\frac{5\,x-3}{25},-\frac{16\,{x}^{3}+27\,{x}^{2}-62\,x-37}{25}]
\end{math}
%%%%%%%%%%%%%%%
\end{document}
错误消息
Missing } inserted \end{minipage}
当我包含 tcolorbox 包时出现错误,我在我的文档中大量使用这个包。
谢谢
答案1
该错误与 无关tcolorbox
。您必须将结束括号\end{verbatim}
放在新行中,否则它会被删除:
\documentclass[10pt,a4paper,oneside,spanish]{article}
\usepackage[spanish,es-nodecimaldot]{babel}
\setlength{\parskip}{\medskipamount}
\setlength{\parindent}{0pt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setcounter{secnumdepth}{4}
\setcounter{tocdepth}{4}
\usepackage{units}
\usepackage{endnotes}
\usepackage{amsthm}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{color,xcolor}
\usepackage[total={15cm,21cm},left=2cm,top=2cm]{geometry}
\usepackage{tcolorbox}
\tcbuselibrary{breakable,skins}
\newcounter{exe}
\newcommand{\titulo}{
\node[fill=blue!20,
rounded corners,
draw=black,
text=black,
line width=1pt,
inner sep=4pt,
anchor=west,
xshift=12pt]
at (frame.north west){\bfseries Ejercicio \stepcounter{exe}\theexe.};
}
\newtcolorbox{ejercicio}{
enhanced,
overlay unbroken and first={\titulo},
colframe=orange,
boxrule=1pt,
arc=3mm,
breakable,
top=15pt,
before=\vskip18pt,
}
\begin{document}
\begin{ejercicio}
A sample
\end{ejercicio}
\noindent
%%%%%%%%%%%%%%%
%%% INPUT:
\begin{minipage}[t]{8ex}{\color{red}\bf
\begin{verbatim}
(%i1)
\end{verbatim}
}% ------------ new line! ---------------------------------------------
\end{minipage}
\begin{minipage}[t]{\textwidth}{\color{blue}
\begin{verbatim}
divide(x^5-3*x^4+2*x^3-3*x^2+4*x+1,5*x^4-12*x^3+6*x^2-6*x+4,x);
\end{verbatim}
}% ------------ new line! ---------------------------------------------
\end{minipage}
%%% OUTPUT:
\definecolor{labelcolor}{RGB}{100,0,0}
\begin{math}\displaystyle
\parbox{8ex}{\color{labelcolor}\tt{($\!$\%o1)} }
[\frac{5\,x-3}{25},-\frac{16\,{x}^{3}+27\,{x}^{2}-62\,x-37}{25}]
\end{math}
%%%%%%%%%%%%%%%
\end{document}