0

thanks in advance for your precious help. I am trying to highlight non seriffed text commands inside a grey box ="easy here". Something like this:

enter image description here

To get that in Latex, the following code is enough for the purpose (non serif out of the mwe):

\documentclass[11pt]{article}  
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[portuguese]{babel}
\usepackage[framemethod=TikZ]{mdframed}
\newcommand\mybox[2][]{\tikz[overlay]\node[draw=gray!10, fill=gray!10, inner sep=1.5pt, anchor=text, rectangle, rounded corners=0.5mm,#1] {#2};\phantom{#2}}
\newcommand\es[1]{\textsf{\mybox[]{#1}}}
\begin{document}
\mybox{"noProb}\\
\mybox{Still fine: =IF(1<2,"Yes","No")}\\
\mybox{="whyItDoesNotLikeThis:"}\\
\end{document}

However, quotes marks after text produce and odd "extra }" error:

linha 10: Argument of \language@active@arg" has an extra }. \mybox{="whyItDoesNotLikeThis:"}
linha 10: Paragraph ended before \language@active@arg" was complete. \mybox{="whyItDoesNotLikeThis:"}
linha 8: Underfull \hbox (badness 10000) in paragraph

enter image description here

PS: Need to use mdframed for other purpose in the real doc, however, even if only use tikz package, the problem remains. Perhaps there is a proper way to this stuf, as this syntax is more than common all over the internet.

Any hint more than welcome. Have a nice day.

8
  • Note that I would probably move to tcolorbox instead of mdframed. The main issue here is Portuguese babel which makes " into an active char. What exactly does "..." mean in your output? – daleif Apr 4 at 16:04
  • HI @daleif, thanks for your comment. What do you mean with with "..." in output? – user30586 Apr 4 at 17:09
  • What exactly does ="whyItDoesNotLikeThis:" represent? – daleif Apr 4 at 17:14
  • This represents how to enter text in an Excel formula. ="string". I want to highlight whenever mention to commands with the grey box around it, pretty much as we do here in stackexchange – user30586 Apr 4 at 17:22
  • 1
    If you don't use the " shorthand in your text, then you can add \shorthandoff{"} to the start of the document to disable the active " – daleif Apr 4 at 17:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.