1

I have a big problem regarding the menukeys package, which uses tikz to allow you to graphically represent menus/file paths. The major problem: no linebreaks. If a menu item happens to exceed the line length, instead of switching to a new line, it just keeps going endlessly (becoming unreadable).

So, my question is: How do I get the individual tikz drawings to adhere to line breaks?

For the record, I mean something like:

                  |---------||----------------------------||---------
Lorem ipsum dolor |sit amet || consectetur adipiscing elit|| sed do 
                  |---------||----------------------------||---------
-------------------------|
eiusmod tempor incididunt| ut labore et dolore magna aliqua.
-------------------------|

I've already seen this wonderful post (Boxed text, multiline), but since I'm a LaTeX novice, I'm struggling to understand how it works and how I can apply it to the menu design I have to use (not by choice XD).

I'd be super-grateful if the community could help me figure this out!

Here's the current menu style code I'm using (sorry for the bleep-outs, but I don't want to get in trouble for revealing the custom macro names):

\usepackage{menukeys}
\copymenustyle{********}{roundedmenus}
\newmenustylesimple{xxxxxxxx}{%
  tw@set@tikz@colors,
  rounded corners=0.3ex,
  inner sep=0pt,
  inner xsep=2pt,
  text height=1.825ex,
  text depth=0.7ex,
  minimum width=0.7ex,
  font=\relsize{-1}\xxxfontnamexxx,
  signal,
  signal to=nowhere,
  signal pointer angle=110,
}{gray}
\makeatletter
\tw@declare@style*{*******}{% create style manually due to signal to and signal from diffs
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,signal to=east,fill=gray!25]%
               {\strut\CurrentMenuElement};}%
}[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
{%
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,signal from=west,signal to=east,fill=gray!25]%
               {\strut\CurrentMenuElement};}%
}{% Last Item
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont\bfseries,color=white,signal from=west,fill=gray]%
               {\strut\CurrentMenuElement};}%
}{% Other Items
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,color=white,fill=gray]{\strut\CurrentMenuElement};}%
}{gray}
\makeatother
\renewmenumacro{\menu}{********} % default: menus
\renewmenumacro{\directory}{xxxxxxx} % default: paths
\renewmenumacro{\keys}{xxxxxxxxxx} % default: roundedkeys
\renewmenumacro{\directory}[/]{paths}

((btw, apologies for the (somewhat) duplicate post. I couldn't expand on the original since I posted that before I signed up to the site. orz))

  • 3
    Welcome to TeX.SX! Please don't post code fragments. Instead, put your fragments into a complete compilable document that shows the problem. – BambOo Sep 23 '19 at 10:21
  • I'm sorry, @BambOo, I can't do that. These are workplace documents, and the document structure that these fragments are used in is massive. This truly is the best I can do. – user197833 Sep 23 '19 at 10:39
  • 3
    Do not be so humble, I am sure you can do better. You just have to put up a small example showing the issue. See minimal working example (MWE) for some ideas on how to proceed. – BambOo Sep 23 '19 at 10:46
  • 1
    There is no point in closing your account... it is not even for us to decide. However, it is just more difficult to help you with the issue without being able to test code. I just looked at the menukeys documentation, there are multiple hyphenatepaths options that may solve your issue since they allow linebreaks. Test them and see if this helps – BambOo Sep 23 '19 at 11:16
  • 4
    I'm voting to close this question as off-topic because The OP did not answer after answer proposal and deleted his account. – BambOo Sep 27 '19 at 11:28
2

This is not yet an answer, but it is far too long as a comment

Well I can't know for sure if this will help but it may serve as a starting point for discussion. After removing all unnecessary or incomplete code, here is a working example that breaks the paths.

Could you have a look at this and edit your question so that we may move forward. Otherwise this question will be closed because of its incomplete informations.

\documentclass{article}
\usepackage{menukeys}
\makeatletter
\tw@declare@style*{mystyle}{% create style manually due to signal to and signal from diffs
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,signal to=east,fill=gray!25]%
               {\strut\CurrentMenuElement};}%
}[\hspace{-0.2em}\hspace{0em plus 0.1em minus 0.05em}]%
{%
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,signal from=west,signal to=east,fill=gray!25]%
               {\strut\CurrentMenuElement};}%
}{% Last Item
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont\bfseries,color=white,signal from=west,fill=gray]%
               {\strut\CurrentMenuElement};}%
}{% Other Items
   \tikz[baseline={($(tw@node.base)+(0,-0.2ex)$)}]{%
         \node(tw@node)[tw@roundedmenus@base,font=\relsize{-1}\normalfont,color=white,fill=gray]{\strut\CurrentMenuElement};}%
}{gray}
\makeatother


\renewmenumacro{\directory}[/]{mystyle}

\begin{document}
\directory{Macintosh HD/Users/Your Name/Documents/Users/Your Name/Documents/Users/Your Name/Documents/Users/Your Name/Documents/Users/Your Name/Documents}
\end{document}

enter image description here

|improve this answer|||||