-1

I want to make a simple conceptual frame work gravitationally where the connections are not curved from the factors to the event, an example in Fig. 1. My motivation of the gravity approach is in the great thread answer How to find y-axis joint similarity in two pictures?, in an analogue to stiching relativistically images by convert -gravity SouthWest -crop ${W1}x${PX}+0+0 "${1}" +repage check1.png. An illustation of some tools needed here is in the thread TikZ: squares and arrows where rotation and simpfications are necessary, but with the application of the gravity approach. I think the Tikz libraries arrows.meta,chains,decorations.pathreplacing are necessary. Pseudocode

  • how to have a separate between the initial factors just like in Fig. 1
  • start gravitationally arrow from the right-hand-side of the factor text blocks, connect at the center of the image, and then, point to the middle of the event block
  • OR a simple method to make a conceptual flow chart in Tikz

Code without any selection of specific Tikz package because I think it should be possible to do with pure tikz

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,chains,decorations.pathreplacing}
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
% TODO apply here gravity approach 
% 1. in placing factor boxes at the left-hand-side
% 2. in starting arrows from the central right-hand-side of those boxes, 
% 3. in joining together at the middle of the whole picture at the central left-hand-side of the event text box
\end{tikzpicture}
\caption{Conceptual flow chart.}
\end{figure}
\end{document}

Fig. 1 Example of expected output but use below minimal initial factors to the event (produced by Google Spreadsheet)

enter image description here

Setting

Minimal expected initial factors

  • Demographic variables: Age, gender
  • Expert variables: ST, blocks

In connection the the event: Arr.

TeXLive: 2016
Engine: XeTeX
OS: Debian 8.7

  • 1
    what is your problem? please provide MWE and indicate where you stuck. Given code is useless ... – Zarko May 25 '17 at 12:27
  • @Zarko I am thinking if you can make connections gravitationally in LaTeX first. It can be an overkill. – Léo Léopold Hertz 준영 May 25 '17 at 12:30
  • 1
    yes I can, and I did after @Torbjørn T. provide his answer which I exploit as starting point ... which I expect that something similar you will prepare as MWE. – Zarko May 25 '17 at 12:55
6
\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{calc, chains, positioning}
\usepackage{lipsum}

\begin{document}
    \begin{tikzpicture}[
    node distance = 4mm and 16mm,
      start chain = going below,
every node/.style = {draw, fill=gray!30,text width=77mm,
                     on chain},
                        ]
\node (a) {\lipsum*[11]};
\node (b) {\lipsum*[11]};
\node (c) {\lipsum*[11]};
\node (d) {\lipsum*[11]};
%
\coordinate[right=of $(b.east)!0.5!(c.east)$] (e);
% or
% \coordinate[right=of $(a.east)!0.5!(d.east)$] (e);
\node (f) [right=of e] {\lipsum*[2]};
\draw   (a) -| (e) 
        (b) -| (e) 
        (c) -| (e) 
        (d) -| (e);
\draw [->] (e) -- (f);
\end{tikzpicture}
\end{document}

enter image description here

Addendum 1: there is many ways to make TikZ image width equal to text width. One of among them is define nodes width dependent on actual \textwidth. For example:

\documentclass{article}
\usepackage[showframe, % show page layout, this option had to be deleted in real document
            margin=25mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, chains, positioning}
\usepackage{lipsum}


\begin{document}
    \begin{figure}
        \centering
    \begin{tikzpicture}[
    node distance = 4mm and 0.1\textwidth,
      start chain = going below,
every node/.style = {draw, fill=gray!30,
                     minimum width=0.4\textwidth,
                     text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep},
                     on chain},
                        ]
\node (a) {\lipsum*[11]};
\node (b) {\lipsum*[11]};
\node (c) {\lipsum*[11]};
\node (d) {\lipsum*[11]};
%
\coordinate[right=of $(a.east)!0.5!(d.east)$] (e);
\node (f) [right=of e] {\lipsum*[2]};
\draw   (a) -| (e)
        (b) -| (e)
        (c) -| (e)
        (d) -| (e);
\draw [->] (e) -- (f);
\end{tikzpicture}
    \end{figure}
\end{document}

enter image description here

Addendum 2: "Mirrored" version as requested in the comment below:

\documentclass{article}
\usepackage[showframe, % show page layout, this option had to be deleted in real document
            margin=25mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc, chains, positioning}
\usepackage{lipsum}


\begin{document}
    \begin{figure}
        \centering
    \begin{tikzpicture}[
    node distance = 4mm and 0.1\textwidth,
      start chain = going below,
every node/.style = {draw, fill=gray!30,
              minimum width=0.5\textwidth,
              text width =\pgfkeysvalueof{/pgf/minimum width}-2*\pgfkeysvalueof{/pgf/inner xsep},
              on chain},
                        ]
\node (a) {\lipsum*[11]};
\node (b) {\lipsum*[11]};
\node (c) {\lipsum*[11]};
\node (d) {\lipsum*[11]};
%
\coordinate[left=of $(a.west)!0.5!(d.west)$] (e);
\node (f) [minimum width=0.3\textwidth, left=of e] {\lipsum*[11]};
\draw   (a) -| (e)
        (b) -| (e)
        (c) -| (e)
        (d) -| (e);
\draw [->] (e) -- (f);
\end{tikzpicture}
    \end{figure}
\end{document}

enter image description here

Now also the width of nodes are changed (left is narrowed), but the image width is still equal to \textwidth.

  • 1
    In above image is no width=1\textwidth ... do you like to have image width equal text width? – Zarko May 25 '17 at 17:20
  • How can you rotate this picture by a mirror at the x-axis? - - Have the result at the left-hand-side and others at the right-hand-side? - - I am thinking about having extensions from the other side so having like trees. – Léo Léopold Hertz 준영 Jun 5 '17 at 9:55
  • 1
    @LéoLéopoldHertz준영, see addendum 2, if it gives what you like to have. – Zarko Jun 5 '17 at 11:05
  • 1
    @LéoLéopoldHertz준영, sorry, but I don't understand you what you like to extend. One more node? If so, just add it. It seems that would be better if you will ask new question about this. Then more people will see your question and can eventually help you. – Zarko Jun 5 '17 at 15:57
  • I extended the node addition problem here tex.stackexchange.com/q/373403/13173 – Léo Léopold Hertz 준영 Jun 5 '17 at 17:14
5

So, something like this?

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\newcommand\aaa{Text, text, and then some more text which I'll repeat a few times.}
\newcommand\bbb{\aaa{} \aaa{} \aaa}
\begin{document}
\begin{tikzpicture}[
  box/.style={draw,fill=black!30,text width=7cm},
  node distance=5mm]
\node [box] (a) {\bbb};
\node [box,below=of a] (b) {\bbb};
\node [box,below=of b] (c) {\bbb};
\node [box, below=of c] (d) {\bbb};

\draw (a.east) -- ++(1cm,0) coordinate (top);
\draw (b) -- (b-|top);
\draw (c) -- (c-|top);
\draw (d) -| (top) node [pos=0.75,box,text width=3cm,right=1cm] (e) {\aaa};
\draw [<-] (e.west) -- (e.west-|top);
\end{tikzpicture}
\end{document}
  • Yes, exactly. Can you place gravitationally the last arrow pointing from the midle of the left-hand-side text block? – Léo Léopold Hertz 준영 May 25 '17 at 12:33
  • 2
    @LéoLéopoldHertz준영 I haven't got a clue what you mean by gravitationally, and it's not clear to me what you meant there, did I guess right? (See updated answer.) – Torbjørn T. May 25 '17 at 12:37
  • Assume you make the contents of the text heterogenous in the text blocks. Can your drawing adapt to those changes? – Léo Léopold Hertz 준영 May 25 '17 at 12:38
  • 1
    @LéoLéopoldHertz준영 Just try. (The nodes on the left will be spaced 5mm apart regardless of the content, and the node on the right will be placed right of the midpoint of the vertical line.) – Torbjørn T. May 25 '17 at 12:40

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.