TikZ 中的微型人工制品钻石

TikZ 中的微型人工制品钻石

我用 TikZ 绘制了一个流程图,但在菱形决策块中,中心出现了一个小菱形。如何去掉它?

查看屏幕截图

\tikzstyle{decision} = [diamond, draw, fill=blue!10, 
    font=\small, text width=4.5em, text badly centered, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!10, 
    font=\small, text width=9em, text centered, rounded corners, minimum height=3em]
\tikzstyle{line} = [draw, -latex']

\begin{tikzpicture}
    % Place nodes
    \node [block] (init) at (0,0) {set-up acquisition parameters};
        \node [block] (step1) at (0,-2) {bias the SiPM};
        \node [block] (step21) at (-3,-4) {read SiPM data and write in ROOT file};
        \node [block] (step22) at (3,-4) {read current from pico-ampermeter};
        \node [block] (step3) at (0,-6) {write header and current in ROOT file};
    \node [decision] (step4) at (0,-9) {is last bias voltage?};
        \node [block] at (-8,-6) (step41) {update value};
    \node [block] at (0,-12) (step42) {end};
    % Draw edges
    \path [line] (init) -- (step1);
    \path [line] (step1) -- (step21);
    \path [line] (step1) -- (step22);
        \path [line] (step21) -- (step3);
        \path [line] (step22) -- (step3);
        \path [line] (step3) -- (step4);
    \path [line] (step4) -| node [near start, above] {no} (step41);
    \path [line] (step41) |- (step1);
    \path [line] (step4) -- node [midway, right] {yes}(step42);
\end{tikzpicture}

我的代码,用于上面的图片:

\documentclass[a4paper,12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}   
\usepackage{titlesec}
\usepackage[frenchb,british]{babel}  
\usepackage{graphicx}
\usepackage[pdfborder={0 0 0}]{hyperref}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{heuristica}
\usepackage{eulervm}
\usepackage{array}
\usepackage{url}
\usepackage{lscape}
\usepackage{tikz}
\usepackage[european,siunitx]{circuitikz}
\usetikzlibrary{babel,arrows,shapes,positioning,shadows,trees}
\usepackage[top=2cm, right=2cm, bottom=2cm, left=2cm]{geometry}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{subfig}
\usepackage[subfigure]{tocloft}
\usepackage[english]{nomencl}

\begin{document}

\begin{figure}[!h]
\centering
\tikzset{every picture/.style={scale=.8}}
\input{res/flowchart} %texfile containing my flowchart
\caption{Main program flowchart}
\label{fig:flowchart}
\end{figure}

\end{document}

答案1

使用您的代码,已经在他的评论中指出@ignasi,不会生成如图所示的工件:

在此处输入图片描述

当然,我们的测试不会考虑您的实际文档,因为您仍然没有提供任何相关信息。因此,我对上图的测试如下:

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows,shapes.geometric}

\begin{document}
<your code>
\end{document}

题外话:在准备测试时,我对您的代码进行了修改,其中流程图的元素是相对定位的,并且对于使用的样式使用本地设置(使用\tikstyle已弃用)。看看它是否对您有帮助:

\documentclass[tikz,
               border=3mm]{standalone}
\usetikzlibrary{arrows,positioning,shapes.geometric}

\begin{document}
    \begin{tikzpicture}[
    node distance=6mm and 8mm,
    base/.style = {draw, fill=blue!10, font=\small, align=flush center, outer sep=0pt},
decision/.style = {shape=diamond, base,
                   aspect=1.5, text width=4.5em, inner sep=1pt},
   block/.style = {shape=rectangle, base,
                   text width=9em, rounded corners, minimum height=3em},
    line/.style = {draw, -latex'}
                        ]
    % Place nodes
\node (init)   [block]    {set-up acquisition parameters};
\node (step1)  [block,below=of init]                {bias the SiPM};
\node (step21) [block,below  left=of step1.south]   {read SiPM data and write in ROOT file};
\node (step22) [block,below right=of step1.south]   {read current from pico-ampermeter};
\node (step3)  [block,below right=of step21.south]  {write header and current in ROOT file};
    \node (step4) [decision,below=of step3]         {is last bias voltage?};
\node (step41) [block,left=of step3 -| step21.west] {update value};
\node (step42) [block,below=of step4]               {end};
    % Draw edges
\draw[line] (init)   edge (step1)     (step1)  edge (step21)   (step1) edge (step22) 
            (step21) edge (step3)     (step22) edge (step3)    (step3)  to  (step4);
\draw[line] (step4) -| node [near start, above] {no} (step41);
\draw[line] (step41) |- (step1);
\draw[line] (step4) -- node [midway, right] {yes}(step42);
    \end{tikzpicture}
\end{document}

相关内容