пытается соединить две коробки в блок-схеме латекса - PullRequest
0 голосов
/ 20 апреля 2020

Я использую overleaf и пытаюсь подключиться следующим образом. см. Изображение здесь Код передается с использованием следующей страницы

https://www.overleaf.com/3275194655nwtxkzncnhqt

1 Ответ

1 голос
/ 20 апреля 2020

Быстрый и грязный хак для стрелки: \draw[arrow] ([xshift=-0.5cm]Modify AC coefficients.south) -| ([xshift=3cm]Watermarked Image.north);

Пожалуйста,

  • обратите внимание, что вы не должны использовать \tikzstyle, это устарело.
  • также убедитесь, что latin1 действительно подходит для вашего документа. Подавляющее большинство редакторов по умолчанию используют utf8.
  • не злоупотребляйте x для \times

\documentclass{article}

\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>


\begin{document}
\pagestyle{empty}

\tikzset
{
    arrow/.style={
       ->,>=stealth}
}
% Define block styles
\tikzstyle{decision} = [diamond, draw,  
    text width=4.5em, text badly centered, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw,  
    text width=5em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{block1} = [rectangle, draw,  
    text width=6em, text centered, rounded corners, minimum height=4em]
    \tikzstyle{block2} = [rectangle, draw,  
    text width=15em, text centered, rounded corners, minimum height=4em]
     \tikzstyle{block3} = [rectangle, draw,  
    text width=20em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']


\begin{tikzpicture}[node distance = 2.5cm, auto]
    % Place nodes
    \node [block3] (Watermarked Image) {Watermarked Image};
   \node[decision, above of =Watermarked Image,node distance=4cm ] (Difference between selected coefficients) {Difference between selected coefficients };
   \node [block, left of=Difference between selected coefficients, node distance=3.5cm] (Inverse DCT for each block) 
   {Inverse DCT for each block};
   \node [block, right of=Difference between selected coefficients, node distance=3.5cm] (Modify AC coefficients) 
   {Modify AC coefficients and perform Inverse DCT for each block};
   \node [block2, above of=Difference between selected coefficients] (Genetic Algorithm) 
   {Genetic Algorithm search DCT coefficients to find best option for insert watermark};
   \node [block, above of=Genetic Algorithm] (DCT for each block) 
   {DCT for each block};
   \node [block, left of=DCT for each block] (Watermark Message) 
   {Watermark Message};
    \node [block, above of=DCT for each block] (8x8 Image Blocking) 
   {8x8 Image Blocking};
    \node [block, above of=Watermark Message] (Host Image) 
   {Host Image};
    % Draw edges
  \path [line] (Host Image) -- (8x8 Image Blocking);
  \path [line] (8x8 Image Blocking) -- (DCT for each block);  
    \path [line] (DCT for each block) -- (Genetic Algorithm);  
    %\path [line] (Watermark Message) -- (Genetic Algorithm); 
    %\path [line] (Modify AC coefficients) -- (Inverse DCT for each block); 
    %\path [line] (Inverse DCT for each block) -- (Watermarked Image); 
    \path [line] (Genetic Algorithm) -- (Difference between selected coefficients); 
    \path [line] (Difference between selected coefficients) -- node {yes} (Inverse DCT for each block);
    \path [line] (Difference between selected coefficients) -- node {no}(Modify AC coefficients);



     \coordinate (n2nl) at ([xshift=-2cm]Genetic Algorithm.north);
    \coordinate (n2nr) at ([xshift=-3cm]Watermarked Image.north);
    \coordinate (n2ns) at ([xshift=3cm]Watermarked Image.east);

    \draw[arrow] (Watermark Message.south -| n2nl) -- (n2nl);
     \draw[arrow] (Inverse DCT for each block.south -| n2nr) -- (n2nr);
%    \draw[arrow] (Modify AC coefficients.south -| n2ns) -- (n2ns);

    \draw[arrow] ([xshift=-0.5cm]Modify AC coefficients.south) -| ([xshift=3cm]Watermarked Image.north);

\end{tikzpicture}


\end{document}

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...