问题:
我想将tikzpicture
作为一个边距图。我有一个包含该软件包的最小版本sidenotes
。但是,它与 不兼容,tikzpicture
我想在那里使用它。
带有侧注包的 MWE:
\documentclass{scrbook}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{sidenotes}
\usepackage{lipsum}
\begin{document}
\begin{marginfigure}%
\includegraphics[width=\marginparwidth]{example-image-a}
\end{marginfigure}
\lipsum[1]
\end{document}
问题:
我想tikzpicture
在页边空白处插入一个。它看起来像这样:
\begin{tikzpicture}
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:0.5cm) circle (0.8cm)}
\colorlet{circle edge}{red!50}
\colorlet{circle area}{red!20}
\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}
\setlength{\parskip}{5mm}
\begin{scope}
\clip \firstcircle;
\fill[filled] \secondcircle;
\end{scope}
\draw[outline] \firstcircle node [xshift=-20pt] {$M_2$};
\draw[outline] \secondcircle node {$M_1$};
\node[anchor=south] at (current bounding box.north) {$M_1 \subsetneq M_2$};
\end{tikzpicture}
问题是文档无法编译,但我不知道原因。我做了以下操作:
\begin{marginfigure}%
\begin{figure}
\begin{tikzpicture}
...
\end{tikzpicture}
\end{figure}
\end{marginfigure}
我怎么解决这个问题?
答案1
感谢@cmhughes,这个问题可以得到解答。解决方案是删除图形环境。我提供以下 MWE:
\documentclass{scrbook}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{sidenotes}
\usepackage{lipsum}
\usepackage{tikz}
\usetikzlibrary{matrix,shapes,backgrounds,fit}
\usepackage{amssymb}
\begin{document}
\begin{marginfigure}%
\begin{tikzpicture}
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:0.5cm) circle (0.8cm)}
\colorlet{circle edge}{red!50}
\colorlet{circle area}{red!20}
\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}
\setlength{\parskip}{5mm}
\begin{scope}
\clip \firstcircle;
\fill[filled] \secondcircle;
\end{scope}
\draw[outline] \firstcircle node [xshift=-20pt] {$M_2$};
\draw[outline] \secondcircle node {$M_1$};
\node[anchor=south] at (current bounding box.north) {$M_1 \subsetneq M_2$};
\end{tikzpicture}
\end{marginfigure}
\lipsum[1]
\end{document}