Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long menu hierarchies have no hard wrap #39

Open
wget opened this issue Feb 14, 2015 · 5 comments
Open

Long menu hierarchies have no hard wrap #39

wget opened this issue Feb 14, 2015 · 5 comments

Comments

@wget
Copy link

wget commented Feb 14, 2015

I was writing a Windows-specific documentation about parameters and values to configure in gpedit.msc. I was using the \menu command to represent the hierarchy. As you know Microsoft is using pretty long hierarchy names, like this one (in French) \menu{Configuration de l’ordinateur > Modèles d’administration > Composants Windows > Chiffrement de lecteur BitLocker > Lecteurs du système d’exploitation > Autoriser Bitlocker sans un module de plateforme sécurisée compatible (requiert un mot de passe ou une clé de démarrage sur un disque mémoire flash USB)}.

While the path is cut when the item level changes, the problem arises for the last item which is much larger than the above level. In such a case, this LaTeX package isn't breaking very long keys, so that the text continues in the margin of the page, without having a line break when the text is too long to fit on the same line.

Do you have a solution to circumvent this issue or could please provide a fix?

Thanks in advance.

@wget wget changed the title Long menu keys have no hard wrap Long menu hierarchies have no hard wrap Feb 16, 2015
@tweh
Copy link
Owner

tweh commented Feb 16, 2015

I understand your problem but unfortunately the styles use TikZ nodes to make the arrow boxes around the items in a list an such nodes are boxes which can’t split across lines. Also I’m not sure if menukeys is the best approach for this since the long boxes are very dominant
bildschirmfoto 2015-02-16 um 11 55 37
and for that IMHO no good idea from a designers point of view. I suggest using a more unobtrusive way like this:
bildschirmfoto 2015-02-16 um 11 55 45
which is implemented in this code:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{menukeys}

% new command for the split symbol
\newcommand{\paramsep}{%
   \hspace{0.4em plus 0.1em }%
   \raisebox{0.08ex}{%
      \tikz{%
         \draw (-1ex,0.5ex) -- (0,0.5ex);
         \fill (0,0) -- (0.5ex,0.5ex) -- (0,1ex) -- cycle;
      }%
   }%
   \hspace{0.4em plus 0.1em}%
}

% using menukeys' internals
\makeatletter

\tw@declare@style@simple*{params}{%
   {\sffamily\small\CurrentMenuElement}%
}[\paramsep]{blacknwhite}

\makeatother

\newmenumacro{\params}[>]{params}


\begin{document}
I was writing a Windows-specific documentation about parameters and values to
configure in gpedit.msc. I was using the \params{command} to represent the hierarchy.
As you know Microsoft is using pretty long hierarchy names, like this one (in French
n) \params{Configuration de l’ordinateur > Modèles d’administration > Composants
Windows > Chiffrement de lecteur BitLocker > Lecteurs du système d’exploitation >
Autoriser Bitlocker sans un module de plateforme sécurisée compatible (requiert un
mot de passe ou une clé de démarrage sur un disque mémoire flash USB)}.
\end{document}

I guess this is not the answer you expected but hope it helps, though.

@wget
Copy link
Author

wget commented Mar 6, 2015

Yes, this was not the answer I was expecting, but thanks for your implementation idea.

I wonder when can we use \menu{Foo > Bar} since this is not "beautiful" from a designer point of view and breaks the layout. IMHO, it looks like this feature of your package is not working like expected. Even in this simple use case from my English documentation, look at the path at the right of the screen, the latter breaks the layout:
latex_2015-03-06_0002

I assume we have no solution neither for this simple user case, other than using the implementation you provided above with the simple arrows?

Thanks in advance for your answer.

@tweh
Copy link
Owner

tweh commented Mar 6, 2015

I completly agree with you, that the current implementation is not the optimal way, but actually I don’t know how to do it better ;-) but making breaks in such nodes possible is on my to-do-list. I don’t know when I find the time to work on it, though …

@Skillmon
Copy link
Collaborator

Skillmon commented Nov 15, 2020

There are ways how this could be solved, but they require to not use TikZ nodes for the output.

Instead one could use ulem or soul, or, if LuaTeX is used, lua-ul to get line-breakable output. ulem wouldn't allow hyphenation, soul does break for complicated input, lua-ul is only available in one engine. If we would support line-breakable styles I'd not make them defaults, and in fact put them in separate files users could load (this doesn't have to be transparent to the user, but could be hidden inside some key=value interface used to select, define, or customise the styles).

Another possibility would be to use some marker with which the user could specify allowed breaking points, similar to manual hyphenation with \-. The mechanism would require splitting at that marker and outputting the parts separately but seamlessly (we could even provide a setting in which every space serves as such a break-point-marker).

@tweh
Copy link
Owner

tweh commented Nov 16, 2020

Maybe it would be enough to only provide manual line breaks in an element an then making two nodes in the background with a prober right/left open style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants