Witiko / markdown

:notebook_with_decorative_cover: A package for converting and rendering markdown documents in TeX
http://ctan.org/pkg/markdown
LaTeX Project Public License v1.3c
328 stars 31 forks source link

When mixing chinese and inline equation, extra space need to be added around between them #387

Closed zousiyu1995 closed 9 months ago

zousiyu1995 commented 9 months ago

As shown in figure, two spaces need to be added around inline equation. However, only the second space was correctly added correctly.

image

The minimum working example is,

\documentclass{article}
\usepackage{ctex}
\usepackage{markdown}
    \markdownSetup{%
        texMathDollars=true,
    }

\begin{document}
\begin{markdown}
对数组$a$来讲
\end{markdown}
\end{document}
Witiko commented 9 months ago

@zousiyu1995 Hello, thanks for using the Markdown package.

Sadly, I cannot reproduce your issue with the latest release of the Markdown package using LuaLaTeX from a recent release of TeX Live 2023:

image

Can you please check your .log for the versions of the software you are using? My .log file contains the following:

LaTeX2e <2023-11-01>
L3 programming layer <2023-12-08>
Package: markdown 2023-12-29 v3.2.1-30-gf8829a6f markdown renderer
zousiyu1995 commented 9 months ago

@zousiyu1995 Hello, thanks for using the Markdown package.

Sadly, I cannot reproduce your issue with the latest release of the Markdown package using LuaLaTeX from a recent release of TeX Live 2023:

image

Can you please check your .log for the versions of the software you are using? My .log file contains the following:

LaTeX2e <2023-11-01>
L3 programming layer <2023-12-08>
Package: markdown 2023-12-29 v3.2.1-30-gf8829a6f markdown renderer

Thank you for your reply. Here is the version information in my log file,

LaTeX2e <2023-11-01>
L3 programming layer <2023-12-11>
Package: markdown 2023-04-27 v2.23.0-0-g0b22f91 markdown renderer
Witiko commented 9 months ago

Sadly, I cannot reproduce your issue. When I compile your example document with Markdown 2.23.0, I get the following result:

$ cat > example.tex
\documentclass{article}
\usepackage{ctex}
\usepackage{markdown}
    \markdownSetup{%
        texMathDollars=true,
    }

\begin{document}
\begin{markdown}
对数组$a$来讲
\end{markdown}
\end{document}

$ docker run -v "$PWD":/workdir -w /workdir --rm -i witiko/markdown:2.23.0-0-g0b22f91-latest lualatex example

image

If you have any idea what could be different between our setups, please let me know,

zousiyu1995 commented 9 months ago

@zousiyu1995 Hello, thanks for using the Markdown package.

Sadly, I cannot reproduce your issue with the latest release of the Markdown package using LuaLaTeX from a recent release of TeX Live 2023:

image

Can you please check your .log for the versions of the software you are using? My .log file contains the following:

LaTeX2e <2023-11-01>
L3 programming layer <2023-12-08>
Package: markdown 2023-12-29 v3.2.1-30-gf8829a6f markdown renderer

From this figure, i found one difference. I'm using miktex, but you're using texlive. That could be the problem.

zousiyu1995 commented 9 months ago

I installed texlive 2023 and compiled this example using xelatex,

The command is,

xelatex.exe -shell-escape main.tex

The example is,

\documentclass{article}

\usepackage{ctex}
\usepackage{markdown}
\markdownSetup{
    texMathDollars=true,
}

\begin{document}
对数组$a$来讲

\begin{markdown}
对数组$a$来讲
\end{markdown}

\end{document}

The result is,

image

The log output is,

This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex 2024.1.2)  2 JAN 2024 14:22
entering extended mode
 \write18 enabled.
 %&-line parsing enabled.
**main.tex
(./main.tex
LaTeX2e <2023-11-01>
L3 programming layer <2023-12-11>
(c:/texlive/2023/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(c:/texlive/2023/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2023/05/17 v1.4n Standard LaTeX file (size option)
)
\c@part=\count183
\c@section=\count184
\c@subsection=\count185
\c@subsubsection=\count186
\c@paragraph=\count187
\c@subparagraph=\count188
\c@figure=\count189
\c@table=\count190
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\bibindent=\dimen140
)
(c:/texlive/2023/texmf-dist/tex/latex/ctex/ctex.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2023-12-11 L3 programming layer (loader) 

(c:/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
File: l3backend-xetex.def 2023-11-09 L3 backend support: XeTeX
\g__graphics_track_int=\count191
\l__pdf_internal_box=\box51
\g__pdf_backend_object_int=\count192
\g__pdf_backend_annotation_int=\count193
\g__pdf_backend_link_int=\count194
))
Package: ctex 2022/07/14 v2.5.10 Chinese adapter in LaTeX (CTEX)

(c:/texlive/2023/texmf-dist/tex/latex/ctex/ctexhook.sty
Package: ctexhook 2022/07/14 v2.5.10 Document and package hooks (CTEX)
)
(c:/texlive/2023/texmf-dist/tex/latex/ctex/ctexpatch.sty
Package: ctexpatch 2022/07/14 v2.5.10 Patching commands (CTEX)
)
(c:/texlive/2023/texmf-dist/tex/latex/base/fix-cm.sty
Package: fix-cm 2020/11/24 v1.1t fixes to LaTeX

(c:/texlive/2023/texmf-dist/tex/latex/base/ts1enc.def
File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
LaTeX Font Info:    Redeclaring font encoding TS1 on input line 47.
))
\l__ctex_tmp_int=\count195
\l__ctex_tmp_box=\box52
\l__ctex_tmp_dim=\dimen141
\g__ctex_section_depth_int=\count196
\g__ctex_font_size_int=\count197

(c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctexopts.cfg
File: ctexopts.cfg 2022/07/14 v2.5.10 Option configuration file (CTEX)
)
(c:/texlive/2023/texmf-dist/tex/latex/ctex/engine/ctex-engine-xetex.def
File: ctex-engine-xetex.def 2022/07/14 v2.5.10 XeLaTeX adapter (CTEX)

(c:/texlive/2023/texmf-dist/tex/xelatex/xecjk/xeCJK.sty
Package: xeCJK 2022/08/05 v3.9.1 Typesetting CJK scripts with XeLaTeX

(c:/texlive/2023/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty
Package: xtemplate 2023-10-10 L3 Experimental prototype document functions
\l__xtemplate_tmp_dim=\dimen142
\l__xtemplate_tmp_int=\count198
\l__xtemplate_tmp_muskip=\muskip16
\l__xtemplate_tmp_skip=\skip50
)
\l__xeCJK_tmp_int=\count199
\l__xeCJK_tmp_box=\box53
\l__xeCJK_tmp_dim=\dimen143
\l__xeCJK_tmp_skip=\skip51
\g__xeCJK_space_factor_int=\count266
\l__xeCJK_begin_int=\count267
\l__xeCJK_end_int=\count268
\c__xeCJK_CJK_class_int=\XeTeXcharclass1
\c__xeCJK_FullLeft_class_int=\XeTeXcharclass2
\c__xeCJK_FullRight_class_int=\XeTeXcharclass3
\c__xeCJK_HalfLeft_class_int=\XeTeXcharclass4
\c__xeCJK_HalfRight_class_int=\XeTeXcharclass5
\c__xeCJK_NormalSpace_class_int=\XeTeXcharclass6
\c__xeCJK_CM_class_int=\XeTeXcharclass7
\c__xeCJK_HangulJamo_class_int=\XeTeXcharclass8
\l__xeCJK_last_skip=\skip52
\c__xeCJK_none_node=\count269
\g__xeCJK_node_int=\count270
\c__xeCJK_CJK_node_dim=\dimen144
\c__xeCJK_CJK-space_node_dim=\dimen145
\c__xeCJK_default_node_dim=\dimen146
\c__xeCJK_CJK-widow_node_dim=\dimen147
\c__xeCJK_normalspace_node_dim=\dimen148
\c__xeCJK_default-space_node_skip=\skip53
\l__xeCJK_ccglue_skip=\skip54
\l__xeCJK_ecglue_skip=\skip55
\l__xeCJK_punct_kern_skip=\skip56
\l__xeCJK_indent_box=\box54
\l__xeCJK_last_penalty_int=\count271
\l__xeCJK_last_bound_dim=\dimen149
\l__xeCJK_last_kern_dim=\dimen150
\l__xeCJK_widow_penalty_int=\count272

Package xtemplate Info: Declaring object type 'xeCJK/punctuation' taking 0
(xtemplate)             argument(s) on line 2396.

\l__xeCJK_fixed_punct_width_dim=\dimen151
\l__xeCJK_mixed_punct_width_dim=\dimen152
\l__xeCJK_middle_punct_width_dim=\dimen153
\l__xeCJK_fixed_margin_width_dim=\dimen154
\l__xeCJK_mixed_margin_width_dim=\dimen155
\l__xeCJK_middle_margin_width_dim=\dimen156
\l__xeCJK_bound_punct_width_dim=\dimen157
\l__xeCJK_bound_margin_width_dim=\dimen158
\l__xeCJK_margin_minimum_dim=\dimen159
\l__xeCJK_kerning_total_width_dim=\dimen160
\l__xeCJK_same_align_margin_dim=\dimen161
\l__xeCJK_different_align_margin_dim=\dimen162
\l__xeCJK_kerning_margin_width_dim=\dimen163
\l__xeCJK_kerning_margin_minimum_dim=\dimen164
\l__xeCJK_bound_dim=\dimen165
\l__xeCJK_reverse_bound_dim=\dimen166
\l__xeCJK_margin_dim=\dimen167
\l__xeCJK_minimum_bound_dim=\dimen168
\l__xeCJK_kerning_margin_dim=\dimen169
\g__xeCJK_family_int=\count273
\l__xeCJK_fam_int=\count274
\g__xeCJK_fam_allocation_int=\count275
\l__xeCJK_verb_case_int=\count276
\l__xeCJK_verb_exspace_skip=\skip57

(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2023-10-10 L3 Experimental document command parser
)
Package: fontspec 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX

(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
Package: fontspec-xetex 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTe
X
\l__fontspec_script_int=\count277
\l__fontspec_language_int=\count278
\l__fontspec_strnum_int=\count279
\l__fontspec_tmp_int=\count280
\l__fontspec_tmpa_int=\count281
\l__fontspec_tmpb_int=\count282
\l__fontspec_tmpc_int=\count283
\l__fontspec_em_int=\count284
\l__fontspec_emdef_int=\count285
\l__fontspec_strong_int=\count286
\l__fontspec_strongdef_int=\count287
\l__fontspec_tmpa_dim=\dimen170
\l__fontspec_tmpb_dim=\dimen171
\l__fontspec_tmpc_dim=\dimen172

(c:/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2021/04/29 v2.0v Standard LaTeX package
)
(c:/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg)))
(c:/texlive/2023/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg
File: xeCJK.cfg 2022/08/05 v3.9.1 Configuration file for xeCJK package
))
\ccwd=\dimen173
\l__ctex_ccglue_skip=\skip58
)
\l__ctex_ziju_dim=\dimen174

(c:/texlive/2023/texmf-dist/tex/latex/zhnumber/zhnumber.sty
Package: zhnumber 2022/07/14 v3.0 Typesetting numbers with Chinese glyphs
\l__zhnum_scale_int=\count288
\l__zhnum_tmp_int=\count289

(c:/texlive/2023/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg
File: zhnumber-utf8.cfg 2022/07/14 v3.0 Chinese numerals with UTF8 encoding
))
(c:/texlive/2023/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese.def
File: ctex-scheme-chinese.def 2022/07/14 v2.5.10 Chinese scheme for generic (CT
EX)

(c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg
File: ctex-name-utf8.cfg 2022/07/14 v2.5.10 Caption with encoding UTF-8 (CTEX)
))
(c:/texlive/2023/texmf-dist/tex/latex/tools/indentfirst.sty
Package: indentfirst 2023/07/02 v1.03 Indent first paragraph (DPC)
)
(c:/texlive/2023/texmf-dist/tex/latex/ctex/ctex-c5size.clo
File: ctex-c5size.clo 2022/07/14 v2.5.10 c5size option (CTEX)
)
(c:/texlive/2023/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-windows.def
File: ctex-fontset-windows.def 2022/07/14 v2.5.10 Windows fonts definition (CTE
X)

Package fontspec Info: Could not resolve font "KaiTi/B" (it probably doesn't
(fontspec)             exist).

Package fontspec Info: Could not resolve font "SimHei/I" (it probably doesn't
(fontspec)             exist).

Package fontspec Info: Could not resolve font "SimSun/BI" (it probably doesn't
(fontspec)             exist).

Package fontspec Info: Font family 'SimSun(0)' created for font 'SimSun' with
(fontspec)             options
(fontspec)             [Script={CJK},BoldFont={SimHei},ItalicFont={KaiTi}].
(fontspec)              
(fontspec)              This font family consists of the following NFSS
(fontspec)             series/shapes:
(fontspec)              
(fontspec)             - 'normal' (m/n) with NFSS spec.:
(fontspec)             <->"SimSun/OT:script=hani;language=dflt;"
(fontspec)             - 'small caps'  (m/sc) with NFSS spec.: 
(fontspec)             - 'bold' (b/n) with NFSS spec.:
(fontspec)             <->"SimHei/OT:script=hani;language=dflt;"
(fontspec)             - 'bold small caps'  (b/sc) with NFSS spec.: 
(fontspec)             - 'italic' (m/it) with NFSS spec.:
(fontspec)             <->"KaiTi/OT:script=hani;language=dflt;"
(fontspec)             - 'italic small caps'  (m/scit) with NFSS spec.: 

))
(c:/texlive/2023/texmf-dist/tex/latex/ctex/config/ctex.cfg
File: ctex.cfg 2022/07/14 v2.5.10 Configuration file (CTEX)
)
(c:/texlive/2023/texmf-dist/tex/latex/markdown/markdown.sty
(c:/texlive/2023/texmf-dist/tex/generic/markdown/markdown.tex
\markdownOptionFrozenCacheCounter=\count290
\markdownInputFileStream=\read2
\markdownOutputFileStream=\write3
Package markdown Info: Using mode 3: The lt3luabridge package on input line 266
7.

(c:/texlive/2023/texmf-dist/tex/generic/lt3luabridge/lt3luabridge.tex
\g_luabridge_method_int=\count291

Package luabridge Info: Using shell escape as the bridging method

))
Package: markdown 2023-04-27 v2.23.0-0-g0b22f91 markdown renderer

(c:/texlive/2023/texmf-dist/tex/latex/paralist/paralist.sty
Package: paralist 2017/01/22 v2.7 Extended list environments
\pltopsep=\skip59
\plpartopsep=\skip60
\plitemsep=\skip61
\plparsep=\skip62
\pl@lab=\toks17
)
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2023/05/13 v2.17o AMS math features
\@mathmargin=\skip63

For additional information on amsmath, use the `?' option.
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2021/08/26 v2.01 AMS text

(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks18
\ex@=\dimen175
))
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen176
)
(c:/texlive/2023/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 2022/04/08 v2.04 operator names
)
\inf@bad=\count292
LaTeX Info: Redefining \frac on input line 234.
\uproot@=\count293
\leftroot@=\count294
LaTeX Info: Redefining \overline on input line 399.
LaTeX Info: Redefining \colon on input line 410.
\classnum@=\count295
\DOTSCASE@=\count296
LaTeX Info: Redefining \ldots on input line 496.
LaTeX Info: Redefining \dots on input line 499.
LaTeX Info: Redefining \cdots on input line 620.
\Mathstrutbox@=\box55
\strutbox@=\box56
LaTeX Info: Redefining \big on input line 722.
LaTeX Info: Redefining \Big on input line 723.
LaTeX Info: Redefining \bigg on input line 724.
LaTeX Info: Redefining \Bigg on input line 725.
\big@size=\dimen177
LaTeX Font Info:    Redeclaring font encoding OML on input line 743.
LaTeX Font Info:    Redeclaring font encoding OMS on input line 744.
\macc@depth=\count297
LaTeX Info: Redefining \bmod on input line 905.
LaTeX Info: Redefining \pmod on input line 910.
LaTeX Info: Redefining \smash on input line 940.
LaTeX Info: Redefining \relbar on input line 970.
LaTeX Info: Redefining \Relbar on input line 971.
\c@MaxMatrixCols=\count298
\dotsspace@=\muskip17
\c@parentequation=\count299
\dspbrk@lvl=\count300
\tag@help=\toks19
\row@=\count301
\column@=\count302
\maxfields@=\count303
\andhelp@=\toks20
\eqnshift@=\dimen178
\alignsep@=\dimen179
\tagshift@=\dimen180
\tagwidth@=\dimen181
\totwidth@=\dimen182
\lineht@=\dimen183
\@envbody=\toks21
\multlinegap=\skip64
\multlinetaggap=\skip65
\mathdisplay@stack=\toks22
LaTeX Info: Redefining \[ on input line 2953.
LaTeX Info: Redefining \] on input line 2954.
)
(c:/texlive/2023/texmf-dist/tex/latex/amsfonts/amssymb.sty
Package: amssymb 2013/01/14 v3.01 AMS font symbols

(c:/texlive/2023/texmf-dist/tex/latex/amsfonts/amsfonts.sty
Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
\symAMSa=\mathgroup4
\symAMSb=\mathgroup5
LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
))
(c:/texlive/2023/texmf-dist/tex/latex/csvsimple/csvsimple.sty
(c:/texlive/2023/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2023-10-10 LaTeX2e option processing using LaTeX3 keys
)
Package: csvsimple 2023/10/16 v2.5.0 LaTeX CSV file processing
)
(c:/texlive/2023/texmf-dist/tex/latex/csvsimple/csvsimple-legacy.sty
Package: csvsimple-legacy 2023/10/16 version 2.5.0 LaTeX2e CSV file processing

(c:/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgfrcs.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-common.tex
\pgfutil@everybye=\toks23
\pgfutil@tempdima=\dimen184
\pgfutil@tempdimb=\dimen185
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfutil-latex.def
\pgfutil@abb=\box57
)
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfrcs.code.tex
(c:/texlive/2023/texmf-dist/tex/generic/pgf/pgf.revision.tex)
Package: pgfrcs 2023-01-15 v3.1.10 (3.1.10)
))
(c:/texlive/2023/texmf-dist/tex/latex/pgf/utilities/pgfkeys.sty
(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeys.code.tex
\pgfkeys@pathtoks=\toks24
\pgfkeys@temptoks=\toks25

(c:/texlive/2023/texmf-dist/tex/generic/pgf/utilities/pgfkeyslibraryfiltered.co
de.tex
\pgfkeys@tmptoks=\toks26
))) (c:/texlive/2023/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
)
(c:/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty
Package: etoolbox 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW)
\etb@tempcnta=\count304
)
(c:/texlive/2023/texmf-dist/tex/latex/tools/shellesc.sty
Package: shellesc 2023/07/08 v1.0d unified shell escape interface for LaTeX
Package shellesc Info: Unrestricted shell escape enabled on input line 75.
)
\csv@file=\read3
\c@csvinputline=\count305
\c@csvrow=\count306
\c@csvcol=\count307
\csv@out=\write4
)
(c:/texlive/2023/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty
Package: fancyvrb 2023/11/06 4.5b verbatim text (tvz,hv)

(c:/texlive/2023/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
\KV@toks@=\toks27
)
\FV@CodeLineNo=\count308
\FV@InFile=\read4
\FV@TabBox=\box58
\c@FancyVerbLine=\count309
\FV@StepNumber=\count310
\FV@OutFile=\write5
)
(c:/texlive/2023/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)

(c:/texlive/2023/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)

(c:/texlive/2023/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
)
(c:/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: xetex.def on input line 107.

(c:/texlive/2023/texmf-dist/tex/latex/graphics-def/xetex.def
File: xetex.def 2022/09/22 v5.0n Graphics/color driver for xetex
))
\Gin@req@height=\dimen186
\Gin@req@width=\dimen187
)
(c:/texlive/2023/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2023-12-04 v1.26 LaTeX kernel commands for general use (HO)
)
\markdownLaTeXCitationsCounter=\count311

(c:/texlive/2023/texmf-dist/tex/generic/gobble/gobble.sty
Package: gobble 2019/01/04 v0.2 Provides more gobble macros

(c:/texlive/2023/texmf-dist/tex/generic/gobble/gobble.tex))
(c:/texlive/2023/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip18
Package: url 2013/09/16  ver 3.4  Verb mode for urls, etc.
)
\markdownLaTeXRowCounter=\count312
\markdownLaTeXRowTotal=\count313
\markdownLaTeXColumnCounter=\count314
\markdownLaTeXColumnTotal=\count315
\markdownLaTeXTable=\toks28
\markdownLaTeXTableAlignment=\toks29
\markdownLaTeXTableEnd=\toks30
)
No file main.aux.
\openout1 = `main.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for TU/lmr/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 9.
LaTeX Font Info:    ... okay on input line 9.

Package fontspec Info: Adjusting the maths setup (use [no-math] to avoid
(fontspec)             this).

\symlegacymaths=\mathgroup6
LaTeX Font Info:    Overwriting symbol font `legacymaths' in version `bold'
(Font)                  OT1/cmr/m/n --> OT1/cmr/bx/n on input line 9.
LaTeX Font Info:    Redeclaring math accent \acute on input line 9.
LaTeX Font Info:    Redeclaring math accent \grave on input line 9.
LaTeX Font Info:    Redeclaring math accent \ddot on input line 9.
LaTeX Font Info:    Redeclaring math accent \tilde on input line 9.
LaTeX Font Info:    Redeclaring math accent \bar on input line 9.
LaTeX Font Info:    Redeclaring math accent \breve on input line 9.
LaTeX Font Info:    Redeclaring math accent \check on input line 9.
LaTeX Font Info:    Redeclaring math accent \hat on input line 9.
LaTeX Font Info:    Redeclaring math accent \dot on input line 9.
LaTeX Font Info:    Redeclaring math accent \mathring on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Gamma on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Delta on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Theta on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Lambda on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Xi on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Pi on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Sigma on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Upsilon on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Phi on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Psi on input line 9.
LaTeX Font Info:    Redeclaring math symbol \Omega on input line 9.
LaTeX Font Info:    Redeclaring math symbol \mathdollar on input line 9.
LaTeX Font Info:    Redeclaring symbol font `operators' on input line 9.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `normal' on input line 9.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  OT1/cmr/m/n --> TU/lmr/m/n on input line 9.
LaTeX Font Info:    Encoding `OT1' has changed to `TU' for symbol font
(Font)              `operators' in the math version `bold' on input line 9.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  OT1/cmr/bx/n --> TU/lmr/m/n on input line 9.
LaTeX Font Info:    Overwriting symbol font `operators' in version `normal'
(Font)                  TU/lmr/m/n --> TU/lmr/m/n on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `normal'
(Font)                  OT1/cmr/m/it --> TU/lmr/m/it on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathbf' in version `normal'
(Font)                  OT1/cmr/bx/n --> TU/lmr/b/n on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `normal'
(Font)                  OT1/cmss/m/n --> TU/lmss/m/n on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `normal'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/m/n on input line 9.
LaTeX Font Info:    Overwriting symbol font `operators' in version `bold'
(Font)                  TU/lmr/m/n --> TU/lmr/b/n on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathit' in version `bold'
(Font)                  OT1/cmr/bx/it --> TU/lmr/b/it on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathsf' in version `bold'
(Font)                  OT1/cmss/bx/n --> TU/lmss/b/n on input line 9.
LaTeX Font Info:    Overwriting math alphabet `\mathtt' in version `bold'
(Font)                  OT1/cmtt/m/n --> TU/lmtt/b/n on input line 9.
LaTeX Font Info:    Trying to load font information for U+msa on input line 10.

(c:/texlive/2023/texmf-dist/tex/latex/amsfonts/umsa.fd
File: umsa.fd 2013/01/14 v3.01 AMS symbols A
)
LaTeX Font Info:    Trying to load font information for U+msb on input line 10.

(c:/texlive/2023/texmf-dist/tex/latex/amsfonts/umsb.fd
File: umsb.fd 2013/01/14 v3.01 AMS symbols B
)
\openout3 = `main.markdown.in'.

Package markdown Info: Buffering markdown input into the temporary input file "
main.markdown.in" and scanning for the closing token sequence "\end{markdown}" 
on input line 12.
Package markdown Info: The ending token sequence was found on input line 14.
Package markdown Info: Including markdown document "./main.markdown.in" on inpu
t line 14.
\g_tmpa_iow=\write6
\openout6 = `main.markdown.lua'.

Package luabridge Info: Writing a helper Lua script to file
(luabridge)             \markdownOptionHelperScriptFileName 

Package luabridge Info: Executing a helper Lua script from file
(luabridge)             \markdownOptionHelperScriptFileName 

(|texlua ./main.markdown.lua)
(./_markdown_main/a49fe500c924e057fce78fa65d91f657.md.tex) [1

] (./main.aux)
 ***********
LaTeX2e <2023-11-01>
L3 programming layer <2022/07/14>
 ***********
 ) 
Here is how much of TeX's memory you used:
 11637 strings out of 474831
 321518 string characters out of 5763250
 1925109 words of memory out of 5000000
 33563 multiletter control sequences out of 15000+600000
 562678 words of font info for 66 fonts, out of 8000000 for 9000
 1348 hyphenation exceptions out of 8191
 93i,5n,97p,364b,940s stack positions out of 10000i,1000n,20000p,200000b,200000s

Output written on main.pdf (1 page).
zousiyu1995 commented 9 months ago

I found this problem may be attributed to the compiler. When I used lualatex, the result was correct. However, xelatex can not generate a correct result.

Witiko commented 9 months ago

@zousiyu1995 Thank you for your patience! I can now reproduce your issue.

You can fix your issue by redefining the token renderer for inline math:

\markdownSetup {
    renderers = {
        inlineMath = {$#1$},
    },
}

The default renderer was \begin{math}#1\end{math}, which would produce incorrect spacing with ctex using the XeTeX engine. I cannot reproduce this issue without ctex, so I assume it is ctex-related. Regardless, there seems to be no advantage to using the \begin{math} ... \end{math} environment instead of $ ... $, so I changed the default renderers in #396.