-
Notifications
You must be signed in to change notification settings - Fork 1
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
Highlighting math in LaTeX-style math-mode delimiters \(…\) #6
Comments
Seconded; it's not a limitation that is easy to Google or know about without reading the finer details of the documentation. It's also very unexpected, and there's a solution provided that works immediately. |
Well the code with l3regex is too slow imho, but the etl-code from @Skillmon could be ok. But there are clearly not enough test files in the repository to really check if they are unwanted side effects. So if you want that, help me to improve the test situation: give me three small documents which tests some special soul case. |
Haha, is that a trade? :-) What's the test format? |
@u-fischer I often use LaTeX math \documentclass[ngerman]{article}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[x11names]{xcolor}
\usepackage{soul}
\begin{document}
Bitte \hl{die „schönste“ Gleichung \(e^{i\pi}=-1\) und \emph{den „Satz des Pythagoras“ \(a^2+b^2=c^2\)}} farbig hinterlegen.
% \hl{die schönste Gleichung \(e^{i\pi}=-1\)}%%% for the purposes of this very bug report, you might wish not to mix the issues and take, instead of the line above, only this line.
\end{document} |
@u-fischer the code using I didn't benchmark this, but I reckon this is faster (it also doesn't use \documentclass{article}
\usepackage{soul}
\usepackage{etl}
\ExplSyntaxOn
\cs_set_eq:NN \SOUL_math_start: \(
\cs_set_eq:NN \SOUL_math_end: \)
\cs_set_eq:Nc \SOUL_start:n { SOUL@start }
\cs_set_protected:cpn { SOUL@start } #1
{ \exp_args:Ne \SOUL_start:n { \__SOUL_math_fixer:n {#1} } }
\cs_new:Npn \__SOUL_math_fixer:n
{
\etl_act:nnnnn
\__SOUL_math_fixer_aux:nN
{ \use_i:nn { ~ } }
\__SOUL_math_fixer_aux:nn
{}
}
\cs_new:Npn \__SOUL_math_fixer_aux:nn #1#2
{ { \__SOUL_math_fixer:n {#2} } }
\cs_new:Npn \__SOUL_math_fixer_aux:nN #1#2
{
\token_if_eq_meaning:NNF #2 \SOUL_math_start:
{ \token_if_eq_meaning:NNF #2 \SOUL_math_end: \use_iii:nnn }
$ \use_none:n { \exp_not:N #2 }
}
\ExplSyntaxOff
\begin{document}
Bitte \hl{\emph{den Satz des Pythagoras \(a^2+b^2=c^2\)}} farbig hinterlegen.
\end{document} |
Please integrate http://tex.stackexchange.com/a/443317 or http://tex.stackexchange.com/a/426036 (or an equivalent way of solving the issue) into soul.sty.
Test case failing as of now:
The text was updated successfully, but these errors were encountered: