使用 Lyx 時出現 LaTeX 錯誤:Bad mathchar (32768)

使用 Lyx 時出現 LaTeX 錯誤:Bad mathchar (32768)

在輸出 LyX 文件時,我收到此錯誤訊息:Bad mathchar (32768),解釋如下:“mathchar 數字必須介於 0 和 32767 之間。我將其更改為 0。”,然後是另外兩個錯誤:缺少數字,被視為零。

錯誤的來源似乎是以下創建表的 TeX 檔案:

                 &\multicolumn{3}{c}{Matem\'aticas}                                \\\cmidrule(lr){2-4}
                &\multicolumn{1}{c}{(1)}         &\multicolumn{1}{c}{(2)}         &\multicolumn{1}{c}{(3)}         \\
\midrule
Tratamiento         &        0.07         &        0.08\sym{**} &        0.09\sym{***}\\
                &      (0.08)         &      (0.05)         &      (0.03)         \\
\addlinespace
Controles           &          No         &        S\'i         &        S\'i         \\
\midrule
Observaciones       &        2000         &        2000         &        2000         \

然後,TeX 檔案以名稱 regressions.tex 保存在與 LyX 檔案相同的資料夾中,並透過 Insert-TeX 程式碼插入 LyX 文件中:

\begin{threeparttable}         
\estwide{regressions.tex}{3}{c}
\Figtext{\footnotesize{Errores est\'andares entre par\'entesis.\\ \textit{* p < 0.1, ** p < 0.05, *** p < 0.01.}}}   
\end{threeparttable}

我可以看到此程式碼插入的 LyX 檔案的 pdf 輸出(儘管我收到上述錯誤訊息),但當我將 LyX 檔案插入另一個 LyX 檔案時,它不起作用。

我在主文檔中的其他 Child LyX 文件中還有其他類似的表,並且它們工作正常。我一直沒能找到問題出在哪裡。任何幫助將不勝感激,謝謝!

序言應包括:

\usepackage{booktabs}
\usepackage{threeparttablex}
% *****************************************************************
% Estout related things
% *****************************************************************
\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estwide}[3]{
\vspace{.75ex}{
\textsymbols% Note the added command here
\begin{tabular*}
{\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular*}
}
}

\newcommand{\estauto}[3]{
\vspace{.75ex}{
\textsymbols% Note the added command here
\begin{tabular}{l*{#2}{#3}}
\toprule
\estinput{#1}
\bottomrule
\addlinespace[.75ex]
\end{tabular}
}
}

% Allow line breaks with \\ in specialcells
\newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}
}

編輯:

我遇到過這個問題。它與所使用的特定表無關,但事實上該表可能包含數學字元或以某種方式擾亂了 LyX 處理 tex 程式碼內數學字元的方式。我不知道這在幕後是如何運作的,但在某些情況下會發生一些事情。要解決這個問題,在呼叫上面的程式碼之前,必須有一些在 LyX 文件中使用數學的 TeX 程式碼。 「$$」就夠了。

相關內容