Responding to this question, David Carlisle provided source code that automatically breaks or hyphenates camelCase words so that they may span multiple lines. Breaking or hyphenation occurs before capitals, e.g. camel-Case.
I have successfully used the code and altered it slightly to match my needs (used typewriter font as well as bold text):
\def\@zzz#1{\textbf{\texttt{\hbox\bgroup#1\egroup}}\endgroup}
However, I cannot colour the text. I have tried various things such as
- \textcolor inside David Carlisle's implementation, i.e.
\def\@zzz#1{\textbf{\texttt{\hbox\bgroup\textcolor{mycustomcolor}{#1}\egroup}}\endgroup}
I also tried this with \textcolor outside \textbf - creating a new command that uses \zzz (David Carlisle wrote this won't work, but I got desperate):
\newcommand{\coloredcamel}[1]{\textcolor{mycustomcolor}{\zzz{#1}}} - and a few other variants. For example, I tried the above with both the color package and the xcolor package. I also tried the
\colorcommand.
mycustomcolor was defined using \definecolor{mycustomcolor}{RGB}{201, 20, 15}
Is it somehow possible to colour text in David Carlisle's implementation? Thanks in advance for any help provided.
