0

Below code works fine if copy the tikzpicture to tex file. but in orgmode, looks like the new line not take effect!

#+header: :imagemagick yes :iminoptions -density 300 -opaque white -flatten -geometry 800 :fit yes :noweb yes :headers '("\\usepackage{tikz}") :border 0 :results raw
#+begin_src latex :eval yes :file debug.png
;; https://blog.codecentric.de/en/2018/04/android-zygote-boot-process/
\usetikzlibrary{chains}
\begin{tikzpicture}[start chain]
  \def\desc{
Description1:\\
- line one\\
- line two\\
- line three
,
Description2:\\
- line one\\
- line two\\
- line three
    }
  \foreach \d[count=\i] in \desc {
      \node[on chain] (P\i) {\d};
  }
\end{tikzpicture}
#+end_src

I try to use \\ also but not work either!

enter image description here

2
  • Could you try to encapsulate the text of each node in a \parbox. For instance : \parbox{1.1cm}{ Description1:\\ - line one\\ - line two\\ - line three} If this gives the right result I will write is as a solution.
    – Lgen
    Mar 6 at 15:51
  • exactly, add parbox works fine, Is it possible to make parbox auto fix text width? if use a fixed size, text maybe longer than it!
    – lucky1928
    Mar 6 at 19:45
1

I suggest two ways to obtain the expected result:

  1. Fixed width: use a \parbox to enclose the paragraphs:

\parbox{2cm}{ Description1:\\ - line one\\ - line two\\ - line three}

  1. Variable width: use a \tabular to structure the paragraphs:

\begin{tabular}{l} Description1:\\ - line one\\ - line two\\ - line three \end{tabular}

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.