我使用 texlive 和 LyX,并使用奇特定理模块来获取自定义定理布局。但是,当我将 SIunitx 包与模块一起使用时,LyX 会在 SIunitx 命令中抛出“未定义的控制序列”错误。在 pdflatex 上,文档仍会呈现,但最多只出现几次。在“文章”文档中,它与 ams 定理模块配合良好,但当我将其替换为 fancy theorem 时会出现错误。解决方案是什么?提前感谢任何帮助。
根据要求,我将添加 lyx 和 tex 格式的 MWE:
莱克斯
#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
\usepackage{physics}
\usepackage{siunitx}
\AtBeginDocument{\RenewCommandCopy\qty\SI}
\end_preamble
\use_default_options true
\begin_modules
fancythm
\end_modules
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #b5bd68
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Section
test
\end_layout
\begin_layout Example
This is an example where we'll assume
\begin_inset Formula $g=\qty{10}{m.s^{-2}}$
\end_inset
.
\end_layout
\begin_layout Standard
\end_layout
\end_body
\end_document
TeX
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\usepackage{fancythm}
\declarefancythm{thm}{headfont=\bfseries,bodyfont=\itshape}{Theorem}{blue}{bc-fleur.mps}
\setfancythmkeys{thm}{title=\csname fancythm@thm@defaultname\endcsname}
\declarefancythm{example}{headfont=\bfseries,bodyfont=\upshape\mdseries}{Example}{orange}{bc-plume.mps}
\setfancythmkeys{example}{title=\csname fancythm@example@defaultname\endcsname}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{physics}
\usepackage{siunitx}
\AtBeginDocument{\RenewCommandCopy\qty\SI}
\makeatother
\usepackage{babel}
\expandafter\providecommand\csname fancythm@example@defaultname\endcsname{Example}
\expandafter\providecommand\csname fancythm@thm@defaultname\endcsname{Theorem}
\begin{document}
\section{test}
\begin{example}
This is an example where we'll assume $g=\qty{10}{m.s^{-2}}$.
\end{example}
\end{document}
答案1
这是 代码中的一个错误fancythm
。我错误地覆盖了\fam
原语。感谢您的精彩帖子,并提供了一个很好的简单示例,很容易就发现了这一点。
它已在问题中链接到的存储库的最新版本中得到修复。