texworks
texworks copied to clipboard
Limited flixibility in style definitions for syntax patterns
The current style definitions for syntax patterns as listed in
configurations/syntax-patterns.txt is limited to:
(1) applying regex one line at a time (like sed). Thus multi-line text
cannot be handled.
(2) usage of regex which can not handle nested delimiters. Thus if the
specified regex searches for [^}] and the _text_ itself has a closing
brace, }, then the intended style is lost.
Example:
Add the following definition in syntax-patterns.txt:
red Y \\textcolor\s*\{red\}\s*\{[^}]*\}
Then this works as expected:
\textcolor{red}{This is in red}
But the following two don't:
(1)
\textcolor{red}{This should have been (line break here)
in red}
(2)
\textcolor{red}{This also should have been in red: $\{a,b\}$}
This issue is seen with svn r545 version of Tw on RedHat 5.4, but is
generic to any version of Tw till date and any OS.
See the entire thread initiated by this message:
http://tug.org/pipermail/texworks/2010q1/002130.html
Original issue reported on code.google.com by [email protected] on 20 Jan 2010 at 5:26
Original comment by st.loeffler on 31 Jan 2010 at 10:08
- Added labels: Type-Enhancement
- Removed labels: Type-Defect
Hello,
I would like to propose extension to this and Issue 533: highlighting or
emphasizing entire \begin{}-\end{} block, e.g.
\begin{equation}
\exp^{\imath\phi}=\cos\phi+\imath\sin\phi
\end{equation}
What I expect: the entire block would have background different from other text
around.
Original comment by [email protected] on 21 Mar 2012 at 1:12
(2) can actually be fixed to use
red Y \\textcolor\s*\{red\}\s*\{(\\\}|[^}])*\}
instead of
red Y \\textcolor\s*\{red\}\s*\{[^}]*\}
i.e., symbol "}" will not be treated at the end of expression only when it
follows immediately after "\"
Original comment by [email protected] on 15 May 2012 at 4:41