컬러박스 내부에 교환 다이어그램을 만들기 위해 tikzcd 패키지를 사용하려고 합니다. 코드는 colorbox 환경 외부에서 작동하지만 이 두 환경을 결합하는 데 문제가 있습니다. 어떤 도움이라도 주시면 감사하겠습니다! 아래는 내 코드입니다.
% 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}
답변1
문제는 가 tikzcd
다른 명령에 대한 인수 안에 있을 때 사용해야 한다는 것입니다 ampersand-replacement
.
환경 을 올바르게 정의하면 더 좋습니다 colbox
.
\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}
특히 화살표 위의 레이블에 대한 코드 변경 사항을 확인하십시오.
px
단위로 사용하지 않는 것이 좋습니다 . 해당 값은 고정되어 있지 않으며 장치 해상도와 관련이 없습니다.