在 gb4e 的句子括號中再現 tex 時出錯

在 gb4e 的句子括號中再現 tex 時出錯

當我嘗試重現 tex 文件以產生 gb4e 中的句子括號時出現錯誤。

這是 tex 文件,由 Alan Munn 提供:

\documentclass{article}
\usepackage{gb4e}
\primebars
\begin{document}
\begin{exe}
\ex{\lb{CP} \lb{DP} who_{i} ] \lb{C} did_{j} ] \lb{TP} \lb{DP} you ] \lb{\ibar{T}} t_{j} \lb{VP} see t_{i} ]]]]}
\end{exe}
\end{document}

預期排版: 在此輸入影像描述

我嘗試重現完全相同的程式碼,但是我的程式碼出現了錯誤:

This is pdfTeX, Version 3.141592653-2.6-1.40.26 (TeX Live 2024) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./testlagi.tex
LaTeX2e <2023-11-01> patch level 1
L3 programming layer <2024-02-20>
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/article.cls
Document Class: article 2023/05/17 v1.4n Standard LaTeX document class
(/usr/local/texlive/2024/texmf-dist/tex/latex/base/size10.clo))
(/usr/local/texlive/2024/texmf-dist/tex/latex/gb4e/gb4e.sty
(/usr/local/texlive/2024/texmf-dist/tex/latex/gb4e/cgloss4e.sty))
(/usr/local/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)
(./testlagi.aux)

./testlagi.tex:9: LaTeX Error: Command \rmfamily invalid in math mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
        
./testlagi.tex:9: LaTeX Error: Command \rmfamily invalid in math mode.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.9 \ex{\lb{CP} \lb{DP} w
                         ho_{i} ] \lb{C} did_{j} ] \lb{TP} \lb{DP} you ] \lb...

?                                           
l.9 \ex{\lb{CP} \lb
                   {DP} who_{i} ] \lb{C} did_{j} ] \lb{TP} \lb{DP} you ] \lb...

? 

我在 Mac 上使用 TeXShop。

有什麼解決辦法嗎?

答案1

自 2015 年以來,該軟體包已經打破了數學模式,重新定義\mathrm為文字模式\rmfamily。您應該將其報告給維護人員,但快速解決方法是重新定義舊的 Latex 命令以強制套件採用正確的程式碼路徑。

\documentclass{article}
\ExpandArgs{c}\newcommand{new@fontshape}{anything}
\usepackage{gb4e}
\primebars

\begin{document}
\begin{exe}
\ex{\lb{CP} \lb{DP} who_{i} ] \lb{C} did_{j} ] \lb{TP} \lb{DP} you ] \lb{\ibar{T}} t_{j} \lb{VP} see t_{i} ]]]]}
\end{exe}
\end{document}

在此輸入影像描述

相關內容