带背景的双标签 tikz

带背景的双标签 tikz

从 tikz 图表中删除双重打印标签

在此处输入图片描述

我有一个 tikz 图表,其中的标签出现重复打印。我的印象是,这可能是由于我用来在文档中创建超链接的一些包/命令造成的。

有趣的是,图表中只有一些标签是双重打印的,这是文档中唯一发生这种情况的 tikz 图表(它也是唯一使用背景的图表 - 因此这可能很重要)。

有人能找到去除较低的 x(.;p,I) 和 E(s,p) 的方法吗?

    % !TEX TS-program = pdflatexmk
%%
\documentclass[a4paper,11pt,twoside]{report}
\usepackage[inner=4cm,outer=2cm]{geometry} %INCLUDE FOR THESIS

\usepackage{afterpage}
\usepackage{graphicx}
\usepackage[parfill]{parskip}
\usepackage{multirow}
\usepackage{amsmath, amsthm, amssymb}
%\usepackage{epstopdf}
\usepackage{mathtools}
\usepackage{mathrsfs}
\usepackage{fixltx2e}
\usepackage[mathscr]{euscript}
\usepackage{hyperref}
\usepackage{setspace}
\usepackage[section]{placeins}
\usepackage[labelfont=bf]{caption}
%\usepackage{subfig}
%\usepackage{subcaption}
%\usepackage[automark]{scrpage2}
\usepackage{natbib}
%\usepackage{bibentry}
\usepackage[space]{cite}
\usepackage{titlesec}
\usepackage{ragged2e}
\usepackage{array}
\usepackage[titletoc]{appendix}
\usepackage{upgreek}
\usepackage{fancyhdr}
\setlength{\headheight}{14pt}% ...at least 13.59pt
\usepackage{chapterbib}
\usepackage[version=3]{mhchem}
\usepackage{pdfpages}
\usepackage{calc}
\usepackage[all]{xy}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,calc,arrows.meta,shapes,fit}
\usepackage[noprefix]{nomencl}
\usepackage{alltt}
\usepackage{rotating}
%\usepackage[final]{pdfpages}
\usepackage{csquotes}
\makenomenclature

%pretty pictures
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,backgrounds}
\usepackage[latin1]{inputenc}
\usepackage{verbatim}

%\pgfdeclarelayer{background}

%% START OF DOCUMENT %%
\usepackage{setspace}
\usepackage{fancyhdr}

\fancypagestyle{IHA-fancy-style}{%
  \fancyhf{}% Clear header and footer
 % \fancyhead[LE,RO]{\slshape \rightmark}
  \fancyhead[LE,RO]{\slshape \leftmark}
  \fancyfoot[LE,RO]{\thepage\ }% Custom footer
  \renewcommand{\headrulewidth}{0.4pt}% Line at the header visible
  \renewcommand{\footrulewidth}{0.4pt}% Line at the footer visible
}

% Redefine the plain page style
\fancypagestyle{plain}{%
  \fancyhf{}%
  \fancyfoot[LE,RO]{\thepage\ } %
  \renewcommand{\headrulewidth}{0pt}% Line at the header invisible
  \renewcommand{\footrulewidth}{0.4pt}% Line at the footer visible
}

\pagestyle{IHA-fancy-style}

\makeatletter
\newcounter{imagepage} \newcommand*{\foreachpage}[2]{%
     \begingroup
         \sbox0{\includegraphics{#1}}%
         \xdef\foreachpage@num{\the\pdflastximagepages}%
     \endgroup
\setcounter{imagepage}{0}%
     \@whilenum\value{imagepage}<\foreachpage@num\do{%
         \stepcounter{imagepage}%
         #2\relax }%
     }
\makeatother

%allow smaller pieces of text bellow figures
\renewcommand{\textfraction}{0.15}  % allow minimal text w. figs
\renewcommand{\topfraction}{0.84}   % allow minimal text w. figs
\renewcommand{\floatpagefraction}{0.8}  % allow minimal text w. figs
%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%
\begin{figure}  
\begin{tikzpicture}[loose/.style={inner sep=.7em}, oval/.style={ellipse,draw}] 
\newcommand{\p}{\mathbf{p}} \newcommand{\x}{\mathbf{x}} 
\node[minimum height=1.2ex,inner sep=0pt,circle,fill=black,label={$\p$}](p){};
\begin{scope}[on background layer]
\node[minimum height=13ex,circle,fill=black!11,fill
opacity=0.91,fit=(p),label={$E(\tilde{s},p)$}](pp){};
\end{scope}
%
\node[right=4 of p,minimum
height=13ex,circle,fill=black!11,label={$E(\underset{s}{\sim},\mathbf{p})$}](x1){$\x(\cdot;\p,\mathbf{I})$};
\node[right=5 of p,minimum height=1.2ex,inner sep=0pt,circle,fill=black,label={$\x(\cdot;\p,\mathbf{I})$}](x1){};
\begin{scope}[on background layer]
\node[minimum height=15ex,circle,fill=black!11,fill
opacity=0.91,fit=(x1),label={$E(\tilde{s},p)$}](xx1){};
\end{scope}
\node[right =5 of x1,minimum height=1.2ex,inner sep=0pt,minimum width=0ex,circle,fill=black,label={$y(\cdot;\p,\mathbf{I})$}](y){};
\def\ovalwidth{0.8}%Just used for the left one, adjust to make roughly match the others which are already wide 
\def\ovalheight{0.5}%excess height, all will get the same height.
\coordinate(ovaltop) at ($(pp.north)+(0,\ovalheight)$);
\coordinate(ovalbot) at ($(pp.south)-(0,\ovalheight)$); 
\node[oval,inner sep=2pt,fit={(ovaltop)($(p)+(\ovalwidth,0)$)($(p)-(\ovalwidth,0)$)(ovalbot)},label=$\Omega$]{};
\node[oval,inner sep=2pt,fit={(xx1)(x1|-ovaltop)(x1|-ovalbot)},label=$\mathscr{F}_\Pi (\mathbf{I})$]{};
\node[oval,inner sep=2pt,fit={(y)(y|-ovaltop)(y|-ovalbot)($(y)+(\ovalwidth,0)$)($(y)-(\ovalwidth,0)$)},label=$\mathscr{G}_\Sigma (\mathbf{I})$]{};
\draw[-Latex,shorten >=7pt] ($(p)!0.5!(pp.east)$) -- node [above,inner sep=2em]{$X_\Pi(\p,\mathbf{I})$} (x1.text|-x1); \draw[-Latex,shorten >=5pt] ($(x1)!0.5!(xx1.east)$) -- node [above,inner sep=2em]{$Y_\Sigma(\x(\cdot;\p,I))$} (y); 
\draw[dotted] (pp.north) --  (x1.text|-x1); 
\draw[dotted] (pp.south) --  (x1.text|-x1); 
\draw[dotted] (xx1.north) --  (y); 
\draw[dotted] (xx1.south) --  (y);
 \end{tikzpicture}
\caption{?}
\end{figure}  



\end{document}

答案1

这些标签明确添加到您的 tikzpicture 中,只需删除\node图像中您不想要的所有内容:

\documentclass{report}

\usepackage[mathscr]{euscript}
\usepackage{tikz}
\usetikzlibrary{backgrounds,positioning,calc,arrows.meta,shapes,fit}

\begin{document}

\begin{figure}  
\begin{tikzpicture}[loose/.style={inner sep=.7em}, oval/.style={ellipse,draw}] 
\newcommand{\p}{\mathbf{p}} \newcommand{\x}{\mathbf{x}} 
\node[minimum height=1.2ex,inner sep=0pt,circle,fill=black,label={$\p$}](p){};
\begin{scope}[on background layer]
\node[minimum height=13ex,circle,fill=black!11,fill
opacity=0.91,fit=(p),label={$E(\tilde{s},p)$}](pp){};
\end{scope}
%
%\node[right=4 of p,minimum height=13ex,circle,fill=black!11,label={$E(\underset{s}{\sim},\mathbf{p})$}](x1){$\x(\cdot;\p,\mathbf{I})$};
\node[right=5 of p,minimum height=1.2ex,inner sep=0pt,circle,fill=black,label={$\x(\cdot;\p,\mathbf{I})$}](x1){};
\begin{scope}[on background layer]
\node[minimum height=15ex,circle,fill=black!11,fill
opacity=0.91,fit=(x1),label={$E(\tilde{s},p)$}](xx1){};
\end{scope}
\node[right =5 of x1,minimum height=1.2ex,inner sep=0pt,minimum width=0ex,circle,fill=black,label={$y(\cdot;\p,\mathbf{I})$}](y){};
\def\ovalwidth{0.8}%Just used for the left one, adjust to make roughly match the others which are already wide 
\def\ovalheight{0.5}%excess height, all will get the same height.
\coordinate(ovaltop) at ($(pp.north)+(0,\ovalheight)$);
\coordinate(ovalbot) at ($(pp.south)-(0,\ovalheight)$); 
\node[oval,inner sep=2pt,fit={(ovaltop)($(p)+(\ovalwidth,0)$)($(p)-(\ovalwidth,0)$)(ovalbot)},label=$\Omega$]{};
\node[oval,inner sep=2pt,fit={(xx1)(x1|-ovaltop)(x1|-ovalbot)},label=$\mathscr{F}_\Pi (\mathbf{I})$]{};
\node[oval,inner sep=2pt,fit={(y)(y|-ovaltop)(y|-ovalbot)($(y)+(\ovalwidth,0)$)($(y)-(\ovalwidth,0)$)},label=$\mathscr{G}_\Sigma (\mathbf{I})$]{};
\draw[-Latex,shorten >=7pt] ($(p)!0.5!(pp.east)$) -- node [above,inner sep=2em]{$X_\Pi(\p,\mathbf{I})$} (x1.text|-x1); \draw[-Latex,shorten >=5pt] ($(x1)!0.5!(xx1.east)$) -- node [above,inner sep=2em]{$Y_\Sigma(\x(\cdot;\p,I))$} (y); 
\draw[dotted] (pp.north) --  (x1.text|-x1); 
\draw[dotted] (pp.south) --  (x1.text|-x1); 
\draw[dotted] (xx1.north) --  (y); 
\draw[dotted] (xx1.south) --  (y);
 \end{tikzpicture}
\caption{that's odd?}
\end{figure}  



\end{document}

在此处输入图片描述


题外话:请仅加载您的文档实际需要的包,不要多次加载同一个包。

相关内容