Estoy intentando utilizar el paquete tikzcd para hacer un diagrama conmutativo dentro de un cuadro de colores. Tengo problemas para combinar estos dos entornos, aunque el código funciona fuera del entorno colorbox. ¡Cualquier ayuda sería muy apreciada! A continuación se muestra mi código:
% Colored Boxed Definition
\newenvironment{colbox}[3]{
\begin{center} % Centering minipage
\colorbox[HTML]{#1} { % Set's the color of minipage
\begin{minipage}[b]{380px} % Starts minipage
\textbf{#2}\\ \textit{#3}
\end{minipage}} % End minipage
}{\end{center}}
\begin{document}
\begin{center}
\colorbox[HTML]{F8E0E0}{
\begin{minipage}[c]{450px}
\textbf{Definition 1.1}\\
Let $V^1, \ V^2, \ \ldots , \ V^d, \ T$ be vectors spaces over K and let $\otimes$ be the multilinear mapping
\begin{align*}
&\quad \otimes\\
V^1 \times V^2 \times \ldots \times V^d \ &\longrightarrow \quad T\\\
\end{align*}
such that T equals the space spanned by the image of $\otimes$, and for any multilinear mapping
\begin{align*}
&\quad f\\
V^1 \times V^2 \times \ldots \times V^d \ &\longrightarrow \quad H\\\
\end{align*}
for any vector space H, there exists a unique linear mapping
\begin{align*}
&\quad F\\
T \ &\longrightarrow \quad H\\\
\end{align*}
which makes the following diagram commute
\begin{tikzcd}
V^1 \times V^2 \times \ldots \times V^d \arrow [r, "\otimes"]
\arrow [dr, swap, "f \text{ multilinear}"]
&
T \arrow [densely dotted, d, "\exists 1 \ F \text{ linear}"]
\\
&
H
\end{tikzcd}
T is called the $\textbf{d-fold tensor product of $V^1 \times V^2 \times \ldots \times V^d$}$ and is denoted ${V^1 \otimes V^2 \otimes \ldots \otimes V^d}$, and its elements are called \textbf{tensors}. $\otimes({v^1 \times v^2 \times \ldots \times v^d})$ is denoted ${v^1 \otimes v^2 \otimes \ldots \otimes v^d}$. The tensors in the image of $\otimes$ are called $\textbf{simple tensors}$.
\end{minipage}}
\end{center}
\end{document}
Respuesta1
El problema es que cuando tikzcd
está dentro del argumento de otro comando que necesitas usar ampersand-replacement
.
Es mejor si defines adecuadamente tu colbox
entorno.
\documentclass{article}
\usepackage{amsmath,xcolor,tikz-cd}
% Colored Boxed Definition
\newenvironment{colbox}[3][380pt]{%
\renewcommand{\colboxcolor}{#2}%
\begin{lrbox}{\colboxbox}
\begin{minipage}[b]{#1}
\textbf{#3}\\ \itshape
}{%
\end{minipage}
\end{lrbox}%
\begin{center}
\colorbox[HTML]{\colboxcolor}{\usebox{\colboxbox}}
\end{center}
}
\newsavebox{\colboxbox}
\newcommand{\colboxcolor}
\begin{document}
\begin{colbox}[\dimexpr\textwidth-2\fboxsep]{F8E0E0}{\textbf{Definition 1.1}}
Let $V^1$, $V^2$, \dots, $V^d$, $T$ be vector spaces over $K$ and let
$\otimes$ be the multilinear mapping
\begin{equation*}
V^1 \times V^2 \times \dots \times V^d \xrightarrow{\otimes} T
\end{equation*}
such that $T$ equals the space spanned by the image of $\otimes$, and
for any multilinear mapping
\begin{equation*}
V^1 \times V^2 \times \dots \times V^d \xrightarrow{f} H
\end{equation*}
for any vector space $H$, there exists a unique linear mapping
\begin{equation*}
T \xrightarrow{F} H
\end{equation*}
which makes the following diagram commute
\[
\begin{tikzcd}
V^1 \times V^2 \times \dots \times V^d \arrow [r, "\otimes"]
\arrow [dr, swap, "f \text{ multilinear}"]
&
T \arrow [densely dotted, d, "\exists 1 \ F \text{ linear}"]
\\
&
H
\end{tikzcd}
\]
$T$ is called the \textbf{d-fold tensor product of
$V^1 \times V^2 \times \dots \times V^d$} and is denoted
${V^1 \otimes V^2 \otimes \dots \otimes V^d}$, and its elements
are called \textbf{tensors}.
$\otimes({v^1 \times v^2 \times \dots \times v^d})$ is denoted
${v^1 \otimes v^2 \otimes \dots \otimes v^d}$. The tensors in the
image of $\otimes$ are called $\textbf{simple tensors}$.
\end{colbox}
\end{document}
Tenga en cuenta los cambios que hice en el código, en particular para las etiquetas sobre las flechas.
Recomiendo no usarlo px
como unidad. Su valor no es fijo y no tiene nada que ver con las resoluciones del dispositivo.