3

How can I write the following conceptual diagram in LaTeX?

I am not sure whether it is common to use TikZ for this purpose or if there are other methods available. In the box □, I want to write some brief statement of mathematics like 'has solution on $\Bbb{Q}_p$ for all $p$ : prime and on $\Bbb{R}$.

Enter image description here

I tried the following code, but it is broken.

 \usepackage{tikz} 
\usepackage{amssymb} % For \Bbb
 
\begin{tikzpicture}

 % Draw boxes 
\node[draw, rectangle, align=center] (box1) at (0,0) {has
 solution on $\Bbb{Q}$}; 
\node[draw, rectangle, align=center] (box2) at
 (5,0) {has solution on $\Bbb{Q}_p$ for all $p$ : prime\\ and on
 $\Bbb{R}$.}; 
\node[draw, rectangle, align=center] (box3) at (10,0)
 {\Sha evaluates its failure};
 
% Draw arrows 
\draw[->] (box1) -- node[above,midway] {always holds}
 (box2); 
\draw[->] (box2) -- node[above,midway] {not always hold}
 (box1);
 
 \end{tikzpicture}
2
  • 1
    Here's a list of your new friends: a) tikz.dev , b) \node{}; , c) ` anchor` , use a . for polar notation, d) library arrows.meta . Give it a try and post your code here ... before the question gets closed ...
    – MS-SPO
    Apr 5 at 9:04
  • 1
    Unrelated: Note that \Bbb{...} is just for backwards compatability use \mathbb{...}, plus it should give you a warning in the log.
    – daleif
    Apr 5 at 9:44

2 Answers 2

7

Don't know if this one comes close to your intention.

Changes made:

  • put a few missing lines

  • summarized your options as a style bx

  • made height equal

  • changed arrow tip

  • hat to replace unknown \Sha by \psi

  • for the arrows it was better to make them curved by replacing -- with to[in=,out=]

Hope this helps a little.

\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{amssymb} % For \Bbb
\usetikzlibrary{arrows.meta}
 
\begin{document}
 
 \begin{tikzpicture}[
    bx/.style={draw, rectangle, align=center,   % your options
                minimum height=12mm,            % equal height
              },
    >={Stealth},    % different arrow tip
 ]

    % Draw boxes 
    \node[bx] (box1) at (0,0) {has solution on $\Bbb{Q}$}; 
    \node[bx] (box2) at (5,0) {has solution on $\Bbb{Q}_p$ for all 
                                $p$ : \\prime and on $\Bbb{R}$.}; 
    \node[bx] (box3) at (10,0){$\psi$ evaluates its failure};
     
    % Draw arrows 
    \draw[->] (box1) to[out=30,in=150]  node[above] {always holds} (box2); 
    \draw[->] (box2) to[out=210,in=330] node[below] {not always hold} (box1);

 \end{tikzpicture}
\end{document}

result

P.S.: Here's an example how you can

  • draw a diagram with class standalone
  • include its pdf via package graphicx
7
  • 1
    Cool. Thank you for your beautiful answer. I really appreciate it. Apr 5 at 11:45
  • How do I draw two arrows in a diagram so that it starts from the middle of a box and extends horizontally to connect two boxes? Apr 5 at 11:48
  • A few things to know: 1) nodes are placed at their center by default, i.e. if it adjusts to longer or shorter text, it will do so around its center point; 2) \draw (A) -- (B); connects nodes named A and B, i.e. at their center coordinates, also center-to-center; 3) IF your nodes are placed at the same y-coordinates, your intended result is just a consequence. However, the interior lines are almost never visible. // Same with my to-command: starts at center with outgoing angle (out=...), ends in other center at input angle given. // Does this answer your comment?
    – MS-SPO
    Apr 5 at 12:58
  • To add I tried separating your linear arrows in y direction using e.g. ([yshift=4mm]box1) , but that gave a mess for some reason. That's why I went for the curved ones.
    – MS-SPO
    Apr 5 at 13:00
  • 1
    @BrauerManinobstruction If you load the positioning library (\usetikzlibrary{arrows.meta,positioning} then you can say e.g. \node (box2) [right=25pt of box1.east] {box2 text}; to make more space horizontally between the nodes, which will give you space for a label between them if that's how you want to arrange things.
    – cfr
    Apr 5 at 23:29
1

Here is a possibility with tikzcd.

enter image description here

\documentclass{article}

\usepackage{tikz-cd, amssymb, amsmath}

\begin{document}

\begin{tikzcd}[cells={nodes=draw}, column sep=1cm]
\parbox[c][10mm]{4cm}{\centering has solution on $\mathbb{Q}$}\arrow[r, Rightarrow, shift left=5pt, "/"marking]
& \parbox[c][10mm]{4cm}{\centering has solution on $\mathbb{Q}_p$ for all $p$ : prime and on $\mathbb{R}$.}\arrow[l, Rightarrow, shift left=5pt]
\end{tikzcd}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .