
私の目標は、2 つの可換図を隣り合わせに(ただし中央に揃えて)配置し、2 つのキャプションを付けることです。
次のコードを試しました:
\documentclass[twoside,12pt]{scrartcl}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage[utf8]{inputenc}
\usepackage[thmmarks,amsmath,noconfig,amsthm]{ntheorem}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{cd}
\geometry{tmargin=30mm,bmargin=40mm,lmargin=30mm,rmargin=30mm}
\setlength{\headsep}{15mm}
\begin{document}
\begin{minipage}[t]{0.5\textwidth}
\begin{figure}
\begin{tikzcd}
A \rar["B"] \dar["C"'] \& A \otimes B \\
A \rar["\mathrm{id}"'] \& B \arrow[u, "\phi"']
\end{tikzcd}
\caption{} \label{fig: MonFun2}
\end{figure}
\end{minipage}
\begin{minipage}[t]{0.5\textwidth}
\begin{figure}
\begin{tikzcd}
A \rar["B"] \dar["C"'] \& A \otimes B \\
A \rar["\mathrm{id}"'] \& B \arrow[u, "\phi"']
\end{tikzcd}
\caption{} \label{fig: MonFun3}
\end{figure}
\end{minipage}
\end{document}
(どこかで言ったように、すでに「&」を「\&」に変更しています)。これにより、いくつかのエラーが発生します。
- ! LaTeX エラー: 外部 par モードではありません。
- ! 未定義の制御シーケンス。@xfloat ...@fltovf \fi \global \setbox @currbox
- ! 欠損値はゼロとして扱われます。
- ! パッケージ pgf エラー: tikz@f@1-1-2 という名前のシェイプが認識されていません。
最後のエラーが何回か発生します。誰か助けてくれませんか?
前もって感謝します!
PS 私の最小限の例は可能な限り短いものではありませんが、パッケージが何らかの影響を与えるかどうかわからなかったため、パッケージをジオメトリとして含めたいと考えました。
答え1
パッケージをロードするとfloatrow
問題は解決するようです:
\documentclass[twoside,12pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{enumerate}
\usepackage{geometry}
\geometry{tmargin=30mm,bmargin=40mm,hmargin=30mm, headsep=15mm, showframe}
\usepackage[thmmarks,amsmath,noconfig,amsthm]{ntheorem}
\usepackage{tikz-cd}
\usepackage{caption, floatrow}
\begin{document}
\hfill
\begin{minipage}[t]{0.4\textwidth}
\centering
\begin{figure}[H]
\begin{tikzcd}[ampersand replacement=\&]
A \rar["B"] \dar["C"'] \& A \otimes B \\
A \rar["\mathrm{id}"'] \& B \arrow[u, "\phi"']
\end{tikzcd}
\caption{} \label{fig: MonFun2}
\end{figure}
\end{minipage}
\begin{minipage}[t]{0.4\textwidth}
\centering
\begin{figure}[H]
\begin{tikzcd}[ampersand replacement=\&]
A \rar["B"] \dar["C"'] \& A \otimes B \\
A \rar["\mathrm{id}"'] \& B \arrow[u, "\phi"']
\end{tikzcd}
\caption{} \label{fig: MonFun3}
\end{figure}
\end{minipage}
\hfill\null
\end{document}