[tex-k] [PATCH 09/10] weave: Parse and reject verbatim in TeX part

Benjamin Gray bengray178 at gmail.com
Sun Mar 9 01:47:19 CET 2025


Verbatim control codes are currently ignored in TeX parts. The
copy_tex() procedure only calls control_code() when it finds a '@'. For
the other delimited commands like tex_string and cross references the
"Translate the TeX part of the current module" module will step back and
run get_next() to fully consume the command. However the verbatim
control code just falls to the default handler that ignores it.

Add verbatim to this list of controls that scan the entire command. Also
print an error if we actually get a verbatim, like is done with TeX
strings.
---
 texk/web2c/weave.ch | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/texk/web2c/weave.ch b/texk/web2c/weave.ch
index 620d5bd732..57e4cbc384 100644
--- a/texk/web2c/weave.ch
+++ b/texk/web2c/weave.ch
@@ -622,6 +622,25 @@ this happens.
     buffer[limit]:="|"; in_module_name:=1; output_Pascal; in_module_name:=0;
 @z
 
+ at x [18.222] l.4285 - Reject verbatim in TeX part
+TeX_string,xref_roman,xref_wildcard,xref_typewriter,module_name:
+  begin loc:=loc-2; next_control:=get_next; {skip to \.{@@>}}
+  if next_control=TeX_string then
+    err_print('! TeX string should be in Pascal text only');
+ at .TeX string should be...@>
+  end;
+ at y
+TeX_string,xref_roman,xref_wildcard,xref_typewriter,module_name,verbatim:
+  begin loc:=loc-2; next_control:=get_next; {skip to \.{@@>}}
+  if next_control=TeX_string then
+    err_print('! TeX string should be in Pascal text only')
+ at .TeX string should be...@>
+  else if next_control=verbatim then
+    err_print('! Verbatim string should be in Pascal text only');
+ at .Verbatim string should be...@>
+  end;
+ at z
+
 @x [19.239] l.4537 - omit index and module names if no_xref set
 @<Phase III: Output the cross-reference index@>=
 @y
-- 
2.48.1



More information about the tex-k mailing list.