2

I'd like to break the text in the cell with “require major upgrades”, but I'm not able to.

\documentclass[dvipsnames,svgnames,x11names]{beamer}
\usepackage{amsmath}
\usepackage{amsfonts,amssymb}
\usepackage{xcolor}
\usepackage{txfonts}
\usepackage{graphicx}
\usepackage[edges]{forest}
\usepackage{flexisym}
\usetikzlibrary{shadows,arrows.meta}
\tikzset{
  selected/.style={draw=ProcessBlue, thick, rounded corners=2pt, inner color=ProcessBlue!25, outer color=ProcessBlue!35, drop shadow,},
}
\usepackage{ragged2e}\justifying
\usetheme{warsaw}
\usecolortheme[RGB={100, 90, 150}]{structure}
\begin{document}
\forestset{
  my tree/.style={
    forked edges,
    for tree={
      grow'=0,
      fork sep=5mm,
      drop shadow,
      anchor=parent,
      edge={draw=DarkOrchid3, -Latex, thick},
      l sep'=7.5mm,
    },
    before typesetting nodes={
      tempcounta/.max={level()-1}{tree},
      for tree={
        top color/.wrap pgfmath arg={blue!##1!WildStrawberry!50}{((level()-1)/(tempcounta))*100)},
        bottom color/.wrap pgfmath arg={blue!##1!WildStrawberry}{((level()-1)/(tempcounta))*100)},
        draw/.wrap pgfmath arg={blue!##1!WildStrawberry}{((level()-1)/(tempcounta))*100)},
        text=white,
        tier/.wrap pgfmath arg={tier ##1}{level()},
        content/.wrap value={\strut ##1},
      }
    },
    where level=0{phantom}{},
  }
}
\begin{frame}
\begin{forest}
  my tree
  [
   [Fundamental
     [require major 
    upgrades
   [Thermal
   ]
  [Quantum
  ]]
    ]
  [Technical 
    [Can be reduced
  [Electronics
  ]
    [Charging Noise
    ]
    [Control loops
    ]]
  ]
  [Environmental 
  [Seismic Motion
  ]
    [Magnetic Noise
    ]]
    ]
\end{forest}
\end{frame}
\end{document}
3
  • Please don't ask your entire question in the title. Give it an appropriate title, and write your question as part of the description
    – daleif
    Commented Sep 14, 2021 at 8:47
  • so here I have edited the previous code and I just wanted to break the line "require major upgrades". I used \\ that usually used to break the line. But it's neither working.
    – Vishakha
    Commented Sep 15, 2021 at 14:17
  • I see that you have already got an answer which worked for you, bust just for the records, the forest package has an option linguistics. Using it will start producing line-breaks without requiring tabular.
    – Niranjan
    Commented Jan 12, 2023 at 4:47

1 Answer 1

1

Use tabular:

\begin{forest}
  my tree
  [
   [Fundamental
     [\begin{tabular}{@{}l@{}}require major \\ upgrades\end{tabular}
   [Thermal
   ]
  [Quantum
  ]]
<...the rest is the same...>

enter image description here

Please, note that it should be \usetheme{Warsaw} with uppercase initial. On some systems (Windows) also the lowercase version may work, but the document becomes unportable.

4
  • Thanks a lot! It worked for me. But could you please explain me what's the meaning of this {@{}l@{}}.
    – Vishakha
    Commented Sep 16, 2021 at 7:56
  • If I don't write this error is coming
    – Vishakha
    Commented Sep 16, 2021 at 7:56
  • @Vishakha It's the specifier for the columns in the tabular.
    – egreg
    Commented Sep 16, 2021 at 8:10
  • Okay thanks for clarification
    – Vishakha
    Commented Sep 22, 2021 at 15:20

You must log in to answer this question.

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