slatex / sTeX

A semantic Extension of TeX/LaTeX
49 stars 9 forks source link

Parsing error/macro expansion error? #402

Closed patrick-nicodemus closed 10 months ago

patrick-nicodemus commented 10 months ago

I ran into an error while trying to import a file from the smglom library, namely smglom/sets/mod?set. It could be a problem with that specific file, but the latex code of the smglom file itself looks fine to me, my guess is that it's more likely to be a sTeX parsing error/error in the macro expansion error of the latex code.

I don't have problems compiling that file directly. If I just right click the file smglom/sets/mod/set.en.tex in the sTeX side panel in VSCode, it compiles without any problems. The problem only occurs when I try to import it from another archive.

To create the error, I created a new math archive patn and created a file hello-world.tex in the source directory. The source code is

\documentclass{stex}
\libinput{preamble}
\begin{document}
\begin{smodule}{span}
    \importmodule[smglom/sets]{mod?set}
    Hello, world
\end{smodule}
\end{document}

The compilation fails due to a failure to parse line 17 of that file, smglom/sets/mod/set.en.tex, which is

\symdef{hasprop}[args=2,prec=300]{#1\comp{\;\text{has property}\;}#2}

I don't know what might cause this line to throw an error. Is it treating the semicolons as special characters somehow? Or perhaps the error is earlier in the file and it misattributes it to that line.

I will attach the full pdflatex.log below. You can find the actual error by Ctrl-F Undefined control sequence.

This is pdfTeX, Version 3.141592653-2.6-1.40.25 (TeX Live 2023) (preloaded format=pdflatex 2023.9.15)  17 SEP 2023 19:34
entering extended mode
 restricted \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**/home/patrick/MMT/content/patn/source/hello-world.tex
(/home/patrick/MMT/content/patn/source/hello-world.tex
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-29>
(/usr/local/texlive/2023/texmf-dist/tex/latex/stex/stex.cls (/usr/local/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2023-08-29 L3 programming layer (loader) 
 (/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def
File: l3backend-pdftex.def 2023-04-19 L3 backend support: PDF output (pdfTeX)
\l__color_backend_stack_int=\count185
\l__pdf_internal_box=\box51
)) (/usr/local/texlive/2023/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2023-08-29 LaTeX2e option processing using LaTeX3 keys
)
Document Class: stex 2023/03/19 v3.3.0 sTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/stex/stex.sty (/usr/local/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2020-05-10 v1.25 LaTeX kernel commands for general use (HO)
)
Package: stex 2023/03/19 v3.3.0 sTeX package
 (/usr/local/texlive/2023/texmf-dist/tex/latex/stex/etc/stex-logo.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/tools/xspace.sty
Package: xspace 2014/10/28 v1.13 Space after command names (DPC,MH)
)) (/usr/local/texlive/2023/texmf-dist/tex/latex/standalone/standalone.sty
Package: standalone 2022/10/10 v1.3b Package to include TeX sub-files with preambles
 (/usr/local/texlive/2023/texmf-dist/tex/latex/tools/shellesc.sty
Package: shellesc 2023/04/15 v1.0d unified shell escape interface for LaTeX
Package shellesc Info: Restricted shell escape enabled on input line 77.
) (/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/ifluatex.sty
Package: ifluatex 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.
 (/usr/local/texlive/2023/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2022/02/03 v1.0f TeX engine tests
)) (/usr/local/texlive/2023/texmf-dist/tex/latex/xkeyval/xkeyval.sty
Package: xkeyval 2022/06/16 v2.9 package option processing (HA)
 (/usr/local/texlive/2023/texmf-dist/tex/generic/xkeyval/xkeyval.tex (/usr/local/texlive/2023/texmf-dist/tex/generic/xkeyval/xkvutils.tex
\XKV@toks=\toks17
\XKV@tempa@toks=\toks18
 (/usr/local/texlive/2023/texmf-dist/tex/generic/xkeyval/keyval.tex))
\XKV@depth=\count186
File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
)) (/usr/local/texlive/2023/texmf-dist/tex/latex/currfile/currfile.sty
Package: currfile 2022/10/10 v0.8 Provides the file path elements of the current input file
 (/usr/local/texlive/2023/texmf-dist/tex/latex/kvoptions/kvoptions.sty
Package: kvoptions 2022-06-15 v3.15 Key value format for package options (HO)
 (/usr/local/texlive/2023/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty
Package: kvsetkeys 2022-10-05 v1.19 Key value parser (HO)
)) (/usr/local/texlive/2023/texmf-dist/tex/latex/filehook/filehook.sty
Package: filehook 2022/10/25 v0.8b Hooks for input files
 (/usr/local/texlive/2023/texmf-dist/tex/latex/filehook/filehook-2020.sty
Package: filehook-2020 2022/10/25 v0.8b Hooks for input files
))
\c@currfiledepth=\count187
) (/usr/local/texlive/2023/texmf-dist/tex/latex/gincltex/gincltex.sty (/usr/local/texlive/2023/texmf-dist/tex/latex/svn-prov/svn-prov.sty
Package: svn-prov 2010/04/24 v3.1862 Package Date/Version from SVN Keywords
)
Package: gincltex 2011/09/04 v0.3 Include external LaTeX files like graphics
 (/usr/local/texlive/2023/texmf-dist/tex/latex/adjustbox/adjustbox.sty
Package: adjustbox 2022/10/17 v1.3a Adjusting TeX boxes (trim, clip, ...)
 (/usr/local/texlive/2023/texmf-dist/tex/latex/adjustbox/adjcalc.sty
Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back-ends (calc, etex, pgfmath)
) (/usr/local/texlive/2023/texmf-dist/tex/latex/adjustbox/trimclip.sty
Package: trimclip 2020/08/19 v1.2 Trim and clip general TeX material
 (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
 (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
 (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
) (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 107.
 (/usr/local/texlive/2023/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex
))
\Gin@req@height=\dimen140
\Gin@req@width=\dimen141
) (/usr/local/texlive/2023/texmf-dist/tex/latex/collectbox/collectbox.sty
Package: collectbox 2022/10/17 v0.4c Collect macro arguments as boxes
\collectedbox=\box52
)
\tc@llx=\dimen142
\tc@lly=\dimen143
\tc@urx=\dimen144
\tc@ury=\dimen145
Package trimclip Info: Using driver 'tc-pdftex.def'.
 (/usr/local/texlive/2023/texmf-dist/tex/latex/adjustbox/tc-pdftex.def
File: tc-pdftex.def 2019/01/04 v2.2 Clipping driver for pdftex
))
\adjbox@Width=\dimen146
\adjbox@Height=\dimen147
\adjbox@Depth=\dimen148
\adjbox@Totalheight=\dimen149
\adjbox@pwidth=\dimen150
\adjbox@pheight=\dimen151
\adjbox@pdepth=\dimen152
\adjbox@ptotalheight=\dimen153
 (/usr/local/texlive/2023/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty
Package: ifoddpage 2022/10/18 v1.2 Conditionals for odd/even page detection
\c@checkoddpage=\count188
) (/usr/local/texlive/2023/texmf-dist/tex/latex/varwidth/varwidth.sty
Package: varwidth 2009/03/30 ver 0.92;  Variable-width minipages
\@vwid@box=\box53
\sift@deathcycles=\count189
\@vwid@loff=\dimen154
\@vwid@roff=\dimen155
))
\gincltex@box=\box54
) (/usr/local/texlive/2023/texmf-dist/tex/latex/filemod/filemod-expmin.sty
Package: filemod-expmin 2011/09/19 v1.2 Get and compare file modification times (expandable; minimal)
)) 
* This is sTeX version 3.3.0 *
(/usr/local/texlive/2023/texmf-dist/tex/latex/stex/ldf/stex-en.ldf) (|kpsewhich -var-value STEX_DEBUG) (|kpsewhich -var-value STEX_FORCE_PDF) (/usr/local/texlive/2023/texmf-dist/tex/latex/stex/etc/stex-backend-pdflatex.cfg) (|kpsewhich -var-value STEX_USESMS) (|kpsewhich -var-value STEX_WRITESMS) (|kpsewhich -var-value PWD) (|kpsewhich -var-value HOME) (|kpsewhich -var-value MATHHUB)
\l_stex_docheader_sect=\count190
\l__stex_refs_unnamed_counter_int=\count191
 (|kpsewhich -var-value STEX_CHECKTERMS)
\l_stex_assoc_args_count=\count192
\l_stex_get_symbol_arity_int=\count193
\l__stex_notations_clist_count_int=\count194
\l__stex_expr_arg_counter_int=\count195
\l__stex_expr_count_int=\count196
\l_stex_notation_downprec=\count197
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <7> on input line 7382.
LaTeX Font Info:    External font `cmex10' loaded for size
(Font)              <5> on input line 7382.
) (/usr/local/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2023/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
)
\c@part=\count198
\c@section=\count199
\c@subsection=\count266
\c@subsubsection=\count267
\c@paragraph=\count268
\c@subparagraph=\count269
\c@figure=\count270
\c@table=\count271
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen156
)) (/home/patrick/MMT/content/patn/lib/preamble.tex) (./hello-world.aux)
\openout1 = `hello-world.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
 (/usr/local/texlive/2023/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count272
\scratchdimen=\dimen157
\scratchbox=\box55
\nofMPsegments=\count273
\nofMParguments=\count274
\everyMPshowfont=\toks19
\MPscratchCnt=\count275
\MPscratchDim=\dimen158
\MPnumerator=\count276
\makeMPintoPDFobject=\count277
\everyMPtoPDFconversion=\toks20
) (/usr/local/texlive/2023/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 485.
 (/usr/local/texlive/2023/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live
))
\c__stex_refs_iow=\write3
\openout3 = `hello-world.sref'.

 (/home/patrick/MMT/content/smglom/sets/source/mod/set.en.tex) (/home/patrick/MMT/content/smglom/mv/source/mod/equal.en.tex) (/home/patrick/MMT/content/smglom/math/source/mod/mathematics.en.tex) (/home/patrick/MMT/content/smglom/math/source/mod/mathematics.en.tex) (/home/patrick/MMT/content/smglom/mv/source/mod/equal.en.tex) (/home/patrick/MMT/content/smglom/mv/source/mod/defeq.en.tex) (/home/patrick/MMT/content/smglom/mv/source/mod/defeq.en.tex) (/home/patrick/MMT/content/smglom/sets/source/mod/set.en.tex
/home/patrick/MMT/content/smglom/sets/source/mod/set.en.tex:17: Undefined control sequence.
\l_tmpa_cs #1#2#3#4#5#6#7#8#9->#1\comp {\;\text 
                                                {has property}\;}#2
l.17 ...c=300]{#1\comp{\;\text{has property}\;}#2}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

) [1

{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./hello-world.aux)
 ***********
LaTeX2e <2023-06-01> patch level 1
L3 programming layer <2023-08-29>
 ***********
 ) 
Here is how much of TeX's memory you used:
 5599 strings out of 474934
 122553 string characters out of 5759817
 1917807 words of memory out of 5000000
 27025 multiletter control sequences out of 15000+600000
 558412 words of font info for 37 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 155i,5n,149p,430b,848s stack positions out of 10000i,1000n,20000p,200000b,200000s
</usr/local/texlive/2023/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on hello-world.pdf (1 page, 12503 bytes).
PDF statistics:
 13 PDF objects out of 1000 (max. 8388607)
 7 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)
kohlhase commented 10 months ago

You can see the problem in line ~10 of the log

(/usr/local/texlive/2023/texmf-dist/tex/latex/stex/stex.cls

it takes the sTeX from TeXLive, not the current HEAD of of the sTeX repository. To get this to work you have to

  1. clone https://github.com/slatex/sTeX to /path/to/sTeX
  2. add /path/to/sTex/tex//: early to your TEXINPUTS variable.
  3. try again.
Jazzpirate commented 10 months ago

No, using sTeX from CTAN is perfectly fine.

Jazzpirate commented 10 months ago

The actual problem is the undefined control sequence \text which is in one of the ams*-packages and is used by one of the notations in set. You can either load that manually, or put the correspondong \usepackage in the preamble of your math archive, or, in fact, you can do \libinput[smglom/sets]{preamble} to load all the packages used anywhere in smglom/sets.

The latter might be a bit wasteful, but is the laziest way to solve it :)

patrick-nicodemus commented 10 months ago

Ok, thank you!