TSE: Issue: Latex: latex.syn / latex.txt

4 views
Skip to first unread message

knud van eeden

unread,
Nov 26, 2022, 6:28:25 PM11/26/22
to SemWare TSE Pro Text Editor
Hello,

The syntax highlight for Latex seems to be not working as expected.

This is tested in the latest clean 4.48 
(and also e.g. 4.47, 4.46, 4.45, 4.44, 4.43, 4.42)

Steps to reproduce:

1. Run latest TSE 4.48

2. Load a .tex file (see attached .zipped file, unzip)

3. Then the result is that basically no syntax highlight takes place

4. Expected is that syntax highlight should take place


===

This is the latex.txt

---

wordset=0-9A-Z_a-z
HiliteIncompleteQuotes=FALSE
IgnoreCaseOfKeyWords=FALSE
HiliteIf0StyleComments=TRUE
Transparent=TRUE
CursorLineFlag=CursorLineOverrides
NumberFlag=0
TillEOL1=%
TillEOL2=\section
TillEOL3=\subsection
[KeyWords1]
 \begin \chapter \clearpage \end \goodbreak \linebreak \newpage \section
 \subsection \subsubsection \[ \\ \\* \]
[KeyWords2]
 { }
[KeyWords3]
 [ \ ]
[KeyWords4]
 $
[KeyWords5]
 \$ \% \&

---

Thanks
with friendly greetings
Knud van Eeden

knud van eeden

unread,
Nov 26, 2022, 6:29:21 PM11/26/22
to SemWare TSE Pro Text Editor
ddd.zip

knud van eeden

unread,
Nov 26, 2022, 6:57:34 PM11/26/22
to SemWare TSE Pro Text Editor
A quite stumped why this syntax highlight does not work when the extension is .tex.

It looks like even if I choose a keyword like 'begin' or 'end' (see definition as keyword in latex.txt)
and I separate these as single words surrounded by spaces(see the left window)
it does not color.

===

Here the corresponding latex.txt (compiled with syncfg2 and saved, then restarted TSE).

===

wordset=0-9A-Z_a-z\\
HiliteIncompleteQuotes=FALSE
IgnoreCaseOfKeyWords=FALSE
HiliteIf0StyleComments=TRUE
Transparent=TRUE
CursorLineFlag=CursorLineOverrides
NumberFlag=0
TillEOL1=%
TillEOL2=\section
TillEOL3=\subsection
[KeyWords1]
 begin
 chapter
 clearpage
 end
 goodbreak
 linebreak
 newpage
 subsubsection
[KeyWords2]
 { }
[KeyWords3]
[KeyWords4]
 $
[KeyWords5]


===


Inline image

knud van eeden

unread,
Nov 26, 2022, 7:15:57 PM11/26/22
to SemWare TSE Pro Text Editor
Even a simplest latex.txt (with 1 keyword 'foobar') seems not highlighted.

This is e.g. a simplest latex.txt

---

wordset=0-9A-Z_a-z
HiliteIncompleteQuotes=FALSE
IgnoreCaseOfKeyWords=TRUE
HiliteIf0StyleComments=TRUE
Transparent=TRUE
CursorLineFlag=CursorLineOverrides
NumberFlag=0
[KeyWords1]
foobar

---

and this is the result (thus no highlighting at all it looks like).


Inline image
with friendly greetings
Knud van Eeden

knud van eeden

unread,
Nov 26, 2022, 7:35:57 PM11/26/22
to SemWare TSE Pro Text Editor
One thing has been resolved now. I used .latex, but in tse 4.48 the association has to be .tex.

Keeping checking the possible issue further...

Carlo Hogeveen

unread,
Nov 26, 2022, 7:50:45 PM11/26/22
to sem...@googlegroups.com

 

Change the wordset to the single character “0”,

which does not appear in the keywords.

No, I do not know why that works.

I used a similar trick to get HTML tags syntax hilited.

 

Carlo

 

 

knud van eeden

unread,
Nov 26, 2022, 8:42:33 PM11/26/22
to SemWare TSE Pro Text Editor
Hello,

1. The issue should very probably be caused by the single backslash '\' (in keywords 3)

---

wordset=0-9A-Z_a-z
HiliteIncompleteQuotes=FALSE
IgnoreCaseOfKeyWords=FALSE
HiliteIf0StyleComments=TRUE
Transparent=TRUE
CursorLineFlag=CursorLineOverrides
NumberFlag=0
TillEOL1=%
TillEOL2=\section
TillEOL3=\subsection
[KeyWords1]
 \begin \chapter \clearpage \end \goodbreak \linebreak \newpage \section
 \subsection \subsubsection \[ \\ \\* \]
[KeyWords2]
 { }
[KeyWords3]
 [ \ ]
[KeyWords4]
 $
[KeyWords5]
 \$ \% \&

===

That should be taken away, 

thus before:

[KeyWords3]
 [ \ ]

and after

[KeyWords3]
 [ ]

===

Root cause: Assumed is that the last occurrence of a token overrules previous occurrences of that same token.

S.E. Mitchell

unread,
Nov 26, 2022, 10:16:26 PM11/26/22
to sem...@googlegroups.com
It seems to work for me if you add a slash to the keywords wordset.
--
Sammy
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "SemWare TSE Pro text editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to semware+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/semware/469127120.5080466.1669513351044%40mail.yahoo.com.

knud van eeden

unread,
Nov 26, 2022, 10:36:40 PM11/26/22
to sem...@googlegroups.com
Sammy,

Removing that single slash '\' in keywords 3 
if that reproducible works also at your end would probably be the preferred solution I guess, as that needs only 1 character to change.

Putting extra slashes at each keyword is a larger
effort and a much bigger change thus.
When adding new keywords then it should also be repeated
for each of those keywords and the user will have to remember that also.

Thanks

knud van eeden

unread,
Nov 26, 2022, 10:48:46 PM11/26/22
to sem...@googlegroups.com
One must look really good on the left side because the color is blue
which is not so good distinguisable from color black.

But the keywords 

\begin

and 

\end

are thus successfully highlighted (according to the latex.txt in the right panel).

So only removing the single slash '\' and recompiling using the TSE macro syncfg2 works here OK with a latest clean TSE version 4.48

Inline image

knud van eeden

unread,
Nov 26, 2022, 11:09:25 PM11/26/22
to sem...@googlegroups.com
FYI

I was looking for all the LaTeX keywords in Sjoerd Rienstra's 
latex55.zip.

===

When unzipping that file I noticed:

06/11/2003  09:04           1.571  latex.syn

===

And a .syn file is a SYNtax highlight file thus, in this case for LaTeX.

===

So I thought maybe this is a better syntax highlight for TSE?

===

So then I looked at clean TSE and noticed the same
file size

13/05/2002  18:01           1.571  latex.syn

So I assumed that is one and the same file.

===

And actually Sammy asked in 2003 if anybody had a syntax highlight file for LaTeX.

And Sjoerd Rienstra responded with a latex syntax highlight file which he sent to Semware.

===

So actually the latex.syn file used also in the latest TSE 4.48 is thus Sjoerd Rienstra's syntax highlight file.

===

When you convert his latex.syn from Sjoerd Rienstra's zip file 'latex55.zip' it gives:

---

wordset=0-9A-Z_a-z
HiliteIncompleteQuotes=FALSE
IgnoreCaseOfKeyWords=FALSE
HiliteIf0StyleComments=TRUE
Transparent=TRUE
CursorLineFlag=CursorLineOverrides
NumberFlag=0
TillEOL1=%
TillEOL2=\section
TillEOL3=\subsection
[KeyWords1]
 \ \begin \chapter \clearpage \end \goodbreak \linebreak \newpage \section
 \subsection \subsubsection \[ \\ \\* \]
[KeyWords2]
 { }
[KeyWords3]
 [ ]
[KeyWords4]
 $
[KeyWords5]
 \$ \% \&

---

That is about the same as the latex.syn which comes with the latest TSE 4.48 thus.

So actually in the original Sjoerd Rienstra file 'latex.syn' there is indeed also no backslash present in the 'keywords3' group.

---

Conclusion:

There has been introduced an extra backslash '\' in latex.syn, and this bug / change is thus already existing unnoticed up to 20 years now.
Reply all
Reply to author
Forward
0 new messages