0

I am trying to draw a flowchart with tikz. Below is my try. I am getting some strange errors. Could you help me?

\documentclass[a4paper, 11pt]{article}
\usepackage[a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}



\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{clrscode}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{latexsym}
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{mdframed}
\usepackage{pgf}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{tikzpeople}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor}



\usetikzlibrary{arrows}
\usetikzlibrary{positioning} 
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{shapes.geometric}

\tikzstyle{process} = [rectangle, minimum width=5cm, text width=5cm, minimum             height=1cm, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]
\tikzstyle{name} = [rectangle, minimum width=5cm, text width=5cm, minimum     height=1cm, draw=black]

\DeclareGraphicsExtensions{.pdf,.png,.jpg, .tif}


\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
  \fancyfoot[LE,RO]{\thepage}
  \renewcommand{\familydefault}{\sfdefault}


\newcommand{\legendre}[2]{\genfrac{(}{)}{}{}{#1}{#2}}
\newcommand{\jacobi}[2]{\genfrac{(}{)}{}{}{#1}{#2}}
\newcommand{\congruent}[3]{$#1 \equiv #2 \text{ } \left( \text{mod } #3             \right)$}
\newcommand{\ZNZ}[1][n]{\mathbb{Z}/{#1}\mathbb{Z}}
\newcommand{\ZNZX}[1][n]{(\mathbb{Z}/{#1}\mathbb{Z})^\times}
\newcommand{\QR}[1][n]{\mathcal{QR}_{#1}}
\newcommand{\QNR}[1][n]{\mathcal{QNR}_{#1}}
\newcommand{\QNRP}{\mathcal{QNR}_n^{+1}}
\newcommand{\JNP}{\mathcal{J}_n^{+1}}
\newcommand{\JNM}{\mathcal{J}_n^{-1}}



\begin{document}
    \begin{tikzpicture}[node distance = 1cm]
        \node[name](alice){\textbf{Alice}};
        \node[process, below = of alice](step1){\textbf{Step 1:} Pick two     distinct large Blum primes $p$ and $q$ and set $n \coloneqq pq$.};


\end{tikzpicture}




\end{document}
4

With the help of tikzset and changing nameto myname (as also suggested by nidhin in the comments):

enter image description here

\documentclass[a4paper, 11pt]{article}
\usepackage{mathtools}
\usepackage{tikz}


\usetikzlibrary{arrows}
\usetikzlibrary{positioning} 
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{shapes.geometric}


\tikzset{
    process/.style = {rectangle, 
                      minimum width=5cm, 
                      text width=5cm, 
                      minimum height=1cm, 
                      draw=black},
    myname/.style={rectangle,
                  draw=black,
                  minimum width=5cm,
                  text width=5cm,
                  minimum height=1cm}, 
    arrow/.style = {thick,
                    ->,
                    >=stealth},
        }


\begin{document}
    \begin{tikzpicture}[node distance = 1cm]
        \node[myname](alice){\textbf{Alice}};
        \node[process, below = of alice](step1){\textbf{Step 1:} Pick two     distinct large Blum primes $p$ and $q$ and set $n \coloneqq pq$.};
\end{tikzpicture}
\end{document}
4
  • your node styles process and name are the same. Instead of them, i would rather define only one, for example named box
  • context of you real image is unknown, but this two boxes you can put in chain by use of chains library`
  • a really MWE considering aforementioned than can be:
\documentclass[a4paper, 11pt]{article}
\usepackage{mathtools}

\usepackage{tikz}
\usetikzlibrary{arrows.meta,
               chains,
               positioning}
\tikzset{
box/.style = {rectangle, draw,
              text width=5cm,
              minimum height=1cm},
arr/.style = {thick,-Stealth}, % where is used?
        }

\begin{document}
    \begin{tikzpicture}[
node distance = 1cm,
  start chain = going below
                        ]
    \begin{scope}[every node/.style = {box, on chain}]
\node   (alice) {\textbf{Alice}};
\node   (step1) {\textbf{Step 1:} Pick two distinct large Blum primes 
                 $p$ and $q$ and set $n \coloneqq pq$.};
    \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.