我正在尝试使用 tikzexternal 来生成我的图像的 pdf。我在环境tikzpicture
中使用\begin{figure}
。但是,我无法获得任何 pdf 输出。然后我删除了\begin{figure}
,再次尝试,没有 pdf 输出。我已从“日志和其他文件”检查了日志文件。似乎我正在使用 shell-escape 选项。我不知道问题是什么。
我在这里粘贴了我的代码。也许还有其他库导致了冲突。我不知道。顺便说一句,我使用的是 overleaf
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{dashbox}
\usepackage{subfig}
\usepackage{floatrow}
\usepackage{amsmath}
\usepackage{float}
\usepackage{braket}
\usepackage{graphicx}
\usepackage{qcircuit}
\usepackage{svg}
\usepackage{color}
\xyoption{color}
\def\imagetop#1{\vtop{\null\hbox{#1}}}
\newcommand\dboxed[1]{\dbox{\ensuremath{#1}}}
\usepackage{tikz}
\usepackage{mathtools}%
\usetikzlibrary{decorations.text}
\usepackage{pst-node, pst-arrow}
\usepackage{environ}
\usepackage{adjustbox}
\makeatletter
\newcommand\mathcircled[1]{%
\mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};%
}
\usetikzlibrary{
arrows,
calc,
chains,
decorations,
decorations.text,
decorations.pathmorphing,
matrix,
positioning,
shapes,
tikzmark,
fit
}
\usetikzlibrary{shapes.symbols}
\usepackage{circledsteps}
\usepackage{floatrow}
\tikzset{
mycirc/.style={circle, draw=black, thick, outer sep=0, anchor=#1, inner sep=0, minimum size=1.5ex},
mytext/.style={text=black, anchor=#1, inner sep=0, outer sep=1pt}
}
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{arrow} = [thick,->,>=stealth]
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\usepackage{geometry}
\title{Figure}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\maketitle
%\begin{figure}[H]
%\centering
% \includegraphics[width=0.5\linewidth]{Images/hirarchy.png}
\begin{tikzpicture}
\filldraw[inner color=pink,draw=black] (2,2) circle (3cm);
\path[decorate,decoration={text along path,
text={something},text align=center}] (4,2) arc [start angle= 0,end angle=-360,radius=2];
\draw[inner color = blue ,draw = black] (3,2) circle (2cm);
\path[decorate,decoration={text along path,
text={something},text align=center}] (5,2) arc [start angle= 0,end angle=-360,radius=1.4];
\draw[inner color = pink,outer color=pink,draw = black] (4,2) circle (1cm) node {something};
\end{tikzpicture}
\caption{there was a long caption here}
%\label{fig:hirarchy}
%\end{figure}
\end{document}
答案1
您导入了许多不必要的或重复的包,这可能会导致冲突。下次您还应该报告错误消息。我删除了一些包,这对我有用:
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage[font=footnotesize,labelfont=bf]{caption}
\usepackage{dashbox}
\usepackage{subfig}
%\usepackage{floatrow}
\usepackage{amsmath}
%\usepackage{float}
\usepackage{braket}
\usepackage{qcircuit}
\usepackage{svg}
\usepackage{color}
\xyoption{color}
\def\imagetop#1{\vtop{\null\hbox{#1}}}
\newcommand\dboxed[1]{\dbox{\ensuremath{#1}}}
\usepackage{tikz}
\usepackage{mathtools}%
\usetikzlibrary{decorations.text}
%\usepackage{pst-node, pst-arrow}
%\usepackage{environ}
%\usepackage{adjustbox}
\makeatletter
\newcommand\mathcircled[1]{%
\mathpalette\@mathcircled{#1}%
}
\newcommand\@mathcircled[2]{%
\tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};%
}
\usetikzlibrary{
arrows,
calc,
chains,
decorations,
decorations.text,
decorations.pathmorphing,
matrix,
positioning,
shapes,
tikzmark,
fit
}
\usetikzlibrary{shapes.symbols}
\usepackage{circledsteps}
\usepackage{floatrow}
\tikzset{
mycirc/.style={circle, draw=black, thick, outer sep=0, anchor=#1, inner sep=0, minimum size=1.5ex},
mytext/.style={text=black, anchor=#1, inner sep=0, outer sep=1pt}
}
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{arrow} = [thick,->,>=stealth]
\floatsetup[figure]{style=plain,subcapbesideposition=top}
\usepackage{geometry}
\title{Figure}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\maketitle
\begin{figure}[h]
\centering
% \includegraphics[width=0.5\linewidth]{Images/hirarchy.png}
\begin{tikzpicture}
\filldraw[inner color=pink,draw=black] (2,2) circle (3cm);
\path[decorate,decoration={text along path,
text={something},text align=center}] (4,2) arc [start angle= 0,end angle=-360,radius=2];
\draw[inner color = blue ,draw = black] (3,2) circle (2cm);
\path[decorate,decoration={text along path,
text={something},text align=center}] (5,2) arc [start angle= 0,end angle=-360,radius=1.4];
\draw[inner color = pink,outer color=pink,draw = black] (4,2) circle (1cm) node {something};
\end{tikzpicture}
\caption{there was a long caption here}
\label{fig:hirarchy}
\end{figure}
\end{document}