Sagittarius Rover
Sagittarius Rover
这家伙很懒,什么也没写!

注册于 3年前

回答
460
文章
0
关注者
15

2025年,可以不用cleveref而改用zref-clever:

\documentclass{beamer}
\usepackage{hyperref}
% \usepackage{cleveref}
% \crefformat{equation}{\mbox{Eq. #2(#1)#3}}
% \crefrangeformat{equation}{\mbox{Eqs. #3(#1)#4 to #5(#2)#6}}
% \crefmultiformat{equation}{\mbox{Eqs. #2(#1)#3}}{ and #2(#1)#3}{, #2(#1)#3}{ and #2(#1)#3}
% \crefrangemultiformat{equation}{\mbox{Eqs. #3(#1)#4 to #5(#2)#6}}{ and #3(#1)#4 to #5(#2)#6}{, #3(#1)#4 to #5(#2)#6}{ and #3(#1)#4 to #5(#2)#6}

\usepackage{zref-clever}
\zcRefTypeSetup{equation}{
    name-sg={eq.},
    name-pl={eqs.},
    Name-sg={Eq.},
    Name-pl={Eqs.},
}

\begin{document}

\begin{frame}{Title Here}

    \begin{block}

        \begin{align}
            A  &= B
            \label{eq1}
            \\
             &= C
             \label{eq2}
             \\
             &= D
             \label{eq3}
        \end{align}

    \end{block}

\end{frame}


\begin{frame}{Title Here}

    \begin{block}

        \begin{align}
            A  &= B
            \label{eq4}
            \\
             &= C
             \label{eq5}
             \\
             &= D
             \label{eq6}
        \end{align}

    \end{block}

\end{frame}

\begin{frame}{Title Here}

\begin{block}

    \begin{align}
    A  &= B
    \label{eq7}
    \\
    &= C
    \label{eq8}
    \\
    &= D
    \label{eq9}
    \end{align}

\end{block}

\end{frame}

\begin{frame}
    contents in between
\end{frame}


\begin{frame}

    % \cref{eq1} 

    % \cref{eq1,,eq2}

    % \cref{eq1,eq2,eq3} 

    % \cref{eq1,eq2,eq3,eq7,eq8,eq9} 

    % \cref{eq1,,eq2,,eq3,eq7,eq8,eq9} 

    % \cref{eq6,eq7,eq9} 

    % Eq. \ref{eq1} 
   

    \zcref[S]{eq1} 

    \zcref[S]{eq1,,eq2}

    \zcref[S]{eq1,eq2,eq3} 

    \zcref[S]{eq1,eq2,eq3,eq7,eq8,eq9} 

    \zcref[S]{eq1,,eq2,,eq3,eq7,eq8,eq9} % I want "Eqs. (1),(2),(3) and (7) to (9)"

    \zcref[S]{eq6,eq7,eq9} 

    Eq. \zref{eq1} 
\end{frame}

\end{document}

这样不会报任何警告,虽然「编号形式受到\seq_set_from_clist:Nnclist的解析小问题」,但是很少会用到\cref{eq1,,eq2,,eq3,eq7,eq8,eq9}这样故意空格的需求...

image.png

有些重叠的区域填充两种不同的颜色,会互相遮挡和影响。

从你的第二张图来看,这种遮挡似乎不影响你看图、识别三角形和做题.

如果三角形AMB和三角形QME用合适的阴影方式来填充的话,怎么处理为宜。

我想着主要填充的区域用颜色;次要或者小点的填充区域用阴影,就是哪种相对稀疏的斜杠线阴影。但一直操作不成功。

在tikz中可以使用patterns库,详见这个链接. 事实上你已经调用了,但不知为何你没有去查阅这部分的文档.

\documentclass[tikz,border=5pt]{standalone}
\usepackage{tkz-base}
\usepackage{tkz-euclide}
\usetikzlibrary{patterns,patterns.meta}
\begin{document}
\begin{tikzpicture}
        % ===== 1. 绘制平面直角坐标系 =====
        \tkzInit[xmin=-2.5, xmax=4.5, ymin=-1, ymax=6.3]
        \tkzDrawXY[thick, noticks, >=latex]
        
        % ===== 定义点 =====
        \tkzDefPoints{0/0/O, 0/4/A, 2/0/B, 0/2/E}
        
        \tkzDefTriangle[two angles=90 and 45](A,B)
        \tkzGetPoint{C}
        
        \tkzDefPointBy[projection=onto O--B](C)
        \tkzGetPoint{c}
        
        \tkzDefPointBy[projection=onto C--c](E)
        \tkzGetPoint{e}
        
        \tkzInterLL(C,c)(E,e)
        \tkzGetPoint{D}
        
        \tkzDefMidPoint(E,B)
        \tkzGetPoint{M}
        
        \tkzInterLL(D,M)(O,B)
        \tkzGetPoint{Q}
        
        \tkzCalcLength(A,M)
        \tkzGetLength{dAM}
        
        \tkzDefPointWith[linear normed,K=-\dAM](M,A)
        \tkzGetPoint{Q}
        
        \tkzInterLL(E,D)(A,B)
        \tkzGetPoint{N}


        \tkzFillPolygon[yellow!50, opacity=.5](A,D,C)
        \tkzFillPolygon[yellow!50, opacity=.5](E,Q,D)
        
        \tkzFillPolygon[pattern=north east lines, pattern color=teal](E,Q,M)
        \tkzFillPolygon[pattern={Stars[points=6]},pattern color=magenta](A,B,M)
        
        % ===== 绘制图形 =====
        \tkzDrawSegments[thick](E,B A,M D,M) 
        \tkzDrawPolygon[red, thick](A,B,C)
        \tkzDrawPolygon[blue, thick](E,C,D)
        
        \tkzDrawSegments[dashed, purple!50, thick](Q,M A,D D,Q E,Q) 
        
        % ===== 标示点 =====
        \tkzLabelPoints[above right](C,N)
        \tkzLabelPoints[left](A,E)
        \tkzLabelPoints[right](D)
        \tkzLabelPoints[below](B,Q)
        \tkzLabelPoints[below left](O,M)
    \end{tikzpicture}
\end{document}

image.png

注意最好把:

        \tkzFillPolygon[yellow!50, opacity=.5](A,D,C)
        \tkzFillPolygon[yellow!50, opacity=.5](E,Q,D)
        \tkzFillPolygon[pattern=north east lines, pattern color=teal](E,Q,M)
        \tkzFillPolygon[pattern={Stars[points=6]},pattern color=magenta](A,B,M)

放到:

        % ===== 绘制图形 =====
        \tkzDrawSegments[thick](E,B A,M D,M) 
        \tkzDrawPolygon[red, thick](A,B,C)
        \tkzDrawPolygon[blue, thick](E,C,D)
        \tkzDrawSegments[dashed, purple!50, thick](Q,M A,D D,Q E,Q) 

之前,避免不正确的绘制顺序带来的遮挡。

\documentclass{article}
\usepackage[tt=false]{libertine}
\usepackage{framed}
\usepackage{lipsum}
\newcounter{question}
\newcounter{solution}
\ExplSyntaxOn
\clist_new:N \g_ljh_answer_clist
\cs_generate_variant:Nn \clist_if_in:NnT { NeT }
% 辅助宏 from: https://mp.weixin.qq.com/s/Mc3QawPiD6WnREZejFxigg
\cs_set_nopar:Npn \__module_range_to_list:nN #1#2 {
  \seq_set_split:Nnn \l__module_tmpa_seq { , } { #1 }
  \seq_map_inline:Nn \l__module_tmpa_seq 
  {
    \tl_if_in:nnTF { ##1 }{ - }
    {
      \seq_set_split:Nnn \l__module_tmpb_seq { - } { ##1 }
      \int_step_inline:nnn 
      { \seq_item:Nn \l__module_tmpb_seq { 1 } } 
      { \seq_item:Nn \l__module_tmpb_seq { 2 } } 
      {
        \clist_put_right:Nn #2 { ####1 }
      }
    }
    {
      \clist_put_right:Nn #2 { ##1 }
    }    
  }
}
\NewDocumentEnvironment{question}{+b}{
    \refstepcounter{question}
    \begin{leftbar}
    \noindent \textsf{Question\ \thequestion :}\quad {#1}
    \end{leftbar}
}{}
\NewDocumentEnvironment{solution}{+b}{
    \refstepcounter{solution}
    % why not \clist_if_in:NVT(?)
    \clist_if_in:NeT \g_ljh_answer_clist {\thesolution}
    {
        \begin{leftbar}
        \noindent \textsf{Solution\ \thesolution :}\quad {#1}
        \end{leftbar}
    }
}{}
\NewDocumentEnvironment{Exercises}{ o +b }{
    \group_begin:
    \setcounter{question}{0}
    \setcounter{solution}{0}
    \clist_gclear:N \g_ljh_answer_clist
    \IfNoValueTF{#1}
    {%这里的逻辑没处理太好,不太容易获取这个Exercises一共有多少题目
     %大胆一点...不过效率会不会变低呢(・∀・(・∀・(・∀・*)
        % \int_step_inline:nn {99}{\clist_gput_right:Nn \g_ljh_answer_clist {##1}}
        \__module_range_to_list:nN {1-99} \l_tmpa_clist
    }
    {
        \__module_range_to_list:nN {#1} \l_tmpa_clist
    }
    \clist_gset_eq:NN \g_ljh_answer_clist \l_tmpa_clist
    #2
    \group_end:
}{}
\ExplSyntaxOff
\begin{document}

\begin{Exercises}[1,3-4]
\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\lipsum[1]

\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}
\end{Exercises}


\newpage

\begin{Exercises}
\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\lipsum[2]

\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\begin{question}
    What is the meaning of life?
\end{question}

\begin{solution}
    The meaning of life is a philosophical question regarding the significance of life or existence in general. Many people and cultures have different interpretations of this concept.
\end{solution}

\end{Exercises}

\end{document}

image.png

来自Eureka的答案:

\documentclass[fontset=fandol]{ctexart}
\ctexset{section/format+={\raggedright}}
\renewcommand*{\tableofcontents}{%
  {\hfill\textbf{\Large\contentsname}\hfill}
  \UseName{@mkboth}%
    {\MakeUppercase\contentsname}%
    {\MakeUppercase\contentsname}%
  \UseName{@starttoc}{toc}%
}
\parindent=0pt
\begin{document}

\tableofcontents

\section{aaaa}

\section{bbbb}

\section{cccc}

\section*{ddd}

\end{document}

image.png

不过这里添加的代码量也相比稍长...

BTW,这里的样式为了保持一致,需要用到:

latexdef \section

\section:
\long macro:->\@startsection {section}{1}{\z@ }{-3.5ex \@plus -1ex \@minus -.2ex}{2.3ex \@plus .2ex}{\normalfont \Large \bfseries }

改的不是很好。

注意到amsart.sty中的:

% line 524~549
\def\@setaddresses{\par
  \nobreak \begingroup
\footnotesize
  \def\author##1{\nobreak\addvspace\bigskipamount}%
  \def\\{\unskip, \ignorespaces}%
  \interlinepenalty\@M
  \def\address##1##2{\begingroup
    \par\addvspace\bigskipamount\indent
    \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
    {\scshape\ignorespaces##2}\par\endgroup}%
  \def\curraddr##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent\curraddrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      ##2\par}\endgroup}%
  \def\email##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent\emailaddrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par}\endgroup}%
  \def\urladdr##1##2{\begingroup
    \def~{\char`\~}%
    \@ifnotempty{##2}{\nobreak\indent\urladdrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par}\endgroup}%
  \addresses
  \endgroup
}

其中关键的部分为

    \par\addvspace\bigskipamount\indent
    \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
    {\scshape\ignorespaces##2}\par\endgroup}%

可以修改为「去掉小括号」+「去掉地址的小型大写字体」+「修改缩进」 +「编组内给姓名设置小体大写」...

    \par\addvspace\bigskipamount
    %\indent
    % \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
    \@ifnotempty{##1}{{\scshape\ignorespaces\noindent##1\unskip\par}}%
    % {\scshape\ignorespaces##2}\par\endgroup}%
    {\ignorespaces\noindent##2}\par\endgroup}%

完整代码:

\documentclass[11pt]{amsart}

\makeatletter
\def\@setaddresses{\par
  \nobreak \begingroup
\footnotesize
  \def\author##1{\nobreak\addvspace\bigskipamount}%
  \def\\{\unskip, \ignorespaces}%
  \interlinepenalty\@M
  \def\address##1##2{\begingroup
    \par\addvspace\bigskipamount
    %\indent
    % \@ifnotempty{##1}{(\ignorespaces##1\unskip) }%
    \@ifnotempty{##1}{{\scshape\ignorespaces\noindent##1\unskip\par}}%
    % {\scshape\ignorespaces##2}\par\endgroup}%
    {\ignorespaces\noindent##2}\par\endgroup}%
  \def\curraddr##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent\curraddrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      ##2\par}\endgroup}%
  \def\email##1##2{\begingroup
    \@ifnotempty{##2}{\nobreak\indent\emailaddrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par}\endgroup}%
  \def\urladdr##1##2{\begingroup
    \def~{\char`\~}%
    \@ifnotempty{##2}{\nobreak\indent\urladdrname
      \@ifnotempty{##1}{, \ignorespaces##1\unskip}\/:\space
      \ttfamily##2\par}\endgroup}%
  \addresses
  \endgroup
}
\makeatother


\address[H. Zhu]{School of Physics and Information Engineering, Jiangsu Second Normal University, 6 Xinhe West Road, Shiqiu street, Nanjing 211200, P. R. China}
\email{\tt zhs@fudan.edu.cn}

\address[H. Song]{Department of Basic Courses, P. R. China}
\email{\tt s3@13.com}


\begin{document}

hello!

Here below is the permission:

\end{document}

这将得到:

image.png

BTW, 这无疑是编辑的无理需求...

灰原老师到此一游...
(其实是不慎把回复点成了答案)

第(2)问里面我找了过(1,0)和(1,2)的线段与AB相交得到C点,然后旋转,算是取巧,但总算是顺利画出来了

另外第(2)问是否还有别的合适的画法

其实注意到A(4,0)B(0,4),那么直线AB的方程显然是x+y=4,又因为x_C=1,瞪眼立得C(1,3),又因为旋转的是90°,再瞪眼又显然有D(3,-1)...

直接定下所有点的坐标,然后连线画图就行了😀...

并不需要照着题目的意思慢慢旋转,画图就要找最容易确定图形的思路(?)


第(3)问里面的等腰直角三角形有几个限制条件,我画不出来了

我觉得可以用要证的结论「BD+OB=AB」来取巧

因为要证的结论就一定是对的,这就免去了搜题这一步了😀.

注意到∠OBD=45°,而△OAB又是等腰直角,所以AB⊥CD. 又因为「BD=AB-OB=4√2-4」,所以其实只要确定了「D」点,它是AB过B的垂线,向左下延长「4(√2-1)」的长度得到的,即可唯一确定这个图形.

这样做顶多有一丢丢浮点误差,但是肉眼很难分辨的...

\documentclass[border=5pt]{standalone}
\usepackage{tkz-base}
\usepackage{tkz-euclide}
\begin{document}
\tkzSetUpLine[line width=.8pt]
\begin{tikzpicture}
\tkzInit[xmin=-1,xmax=5,ymin=-2,ymax=5]
\tkzDrawX[noticks,thick]
\tkzDrawY[noticks,right=2pt,thick]
\tkzDefPoints{0/0/O,0/4/A,4/0/B}
\def\lenBD{\fpeval{4*(\tkzSqrTwo-1)}}% 4(√2-1)

% 计算|BD|长度并定点
% \node {\lenBD};
\tkzDefPointWith[orthogonal normed,K=\lenBD](B,A) 
\tkzGetPoint{D}

% 利用角平分线确定M点
\tkzDefLine[bisector,normed](O,B,A) 
\tkzGetPoint{m}
\tkzInterLL(O,A)(B,m)
\tkzGetPoint{M}

% tkz-euclide可以很轻松地通过等腰直角三角形地斜边确定直角顶点
% 实际上手动求垂直平分线 + 确定交点也不难...
\tkzDefTriangle[isosceles right](O,D) 
\tkzGetPoint{C}

%
\tkzLabelPoints[below left](O)
\tkzLabelPoints[left](A,M)
\tkzLabelPoints[below](D,B)
\tkzLabelPoints[left](A,M)
\tkzLabelPoints[above](C)
\tkzDrawPolygons(O,A,B O,B,D O,B,M O,C,D)
\end{tikzpicture}
\end{document}

image.png

方案三:基于ctexheading提供的功能👇

image.png

但要尤其注意的是,在elegantbook.cls中使用的是:

% Line 194-221
\ifdefstring{\ELEGANT@lang}{cn}{
  \ifdefstring{\ELEGANT@chinesefont}{founder}{
    \RequirePackage[UTF8, scheme=plain, fontset=none]{ctex}
    \setCJKmainfont[BoldFont={FZHei-B01},ItalicFont={FZKai-Z03}]{FZShuSong-Z01}
    \setCJKsansfont[BoldFont={FZHei-B01}]{FZKai-Z03}
    \setCJKmonofont[BoldFont={FZHei-B01}]{FZFangSong-Z02}
    \setCJKfamilyfont{zhsong}{FZShuSong-Z01}
    \setCJKfamilyfont{zhhei}{FZHei-B01}
    \setCJKfamilyfont{zhkai}[BoldFont={FZHei-B01}]{FZKai-Z03}
    \setCJKfamilyfont{zhfs}[BoldFont={FZHei-B01}]{FZFangSong-Z02}
    \newcommand*{\songti}{\CJKfamily{zhsong}}
    \newcommand*{\heiti}{\CJKfamily{zhhei}}
    \newcommand*{\kaishu}{\CJKfamily{zhkai}}
    \newcommand*{\fangsong}{\CJKfamily{zhfs}}}{\relax}
  
  \ifdefstring{\ELEGANT@chinesefont}{nofont}{
    \RequirePackage[UTF8,scheme=plain,fontset=none]{ctex}
    \xeCJKsetup{AutoFakeBold=true}
    }{\relax}

  \ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
    \RequirePackage[UTF8,scheme=plain]{ctex}
    \xeCJKsetup{AutoFakeBold=true}
    }{\relax}
  
  \AfterEndPreamble{
    \setlength\parindent{2\ccwd}}
}{\relax}
\RequirePackage[UTF8,scheme=plain]{ctex}

这并不会启用heading=true:

image.png

下面的workaround使用了\PassOptionsToPackage{heading=true}{ctex}:

\PassOptionsToPackage{heading=true}{ctex}
\documentclass[lang=cn,scheme=chinese]{elegantbook}
\usepackage{zhlipsum}
\usepackage{geometry}
\geometry{paperheight=10cm}
\begin{document}
\ctexset{chapter/pagestyle = fancy}

\chapter{标题标题}
\zhlipsum[2]

\chapter{标题标题}
\zhlipsum[2]
\end{document}

image.png

期待更多可能的回答~

方案二:使用etoolbox提供的\patchcmd命令:

\documentclass[lang=cn,scheme=chinese]{elegantbook}
\usepackage{zhlipsum}
\geometry{paperheight=10cm}
\patchcmd{\chapter}{\thispagestyle{plain}}{}{}{}
\begin{document}
\chapter{标题标题}
\zhlipsum[2]

\chapter{标题标题}
\zhlipsum[2]
\end{document}

image.png

方案一:使用fancyhdr提供的方案,将plain设置为fancy样式:

\documentclass[lang=cn,scheme=chinese]{elegantbook}
\usepackage{zhlipsum}
\geometry{paperheight=10cm}
\fancypagestyle{plain}[fancy]{}
\begin{document}
\chapter{标题标题}
\zhlipsum[2]

\chapter{标题标题}
\zhlipsum[2]
\end{document}

image.png

这看上去非常AI,直接拿着AI生成的代码提问可不是非常鼓励的...

  1. 请把你的代码补充完整(编辑问题),从\documentclss开始到\end{document}结束
  2. 请把你代码的编译截图也上传,具体指明是哪段代码在实现「标题与正文之间的距离调节」,但实际上没有改变

@u26254 有一个2023年才出现的子库tikz-nfold: https://ctan.org/ctan-ann/pkg/tikz-nfold

\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{nfold}
\begin{document}

\tikz\draw[double,teal] (0,0) rectangle (1,1);

\tikz\draw[double distance=1pt,nfold=3,violet] (0,0) rectangle (1,1);

\tikz\draw[line join=round, double distance=4pt, nfold=4, magenta] (0,0) rectangle (1,1);

\end{document}

image.png

Refs: https://tex.stackexchange.com/a/692283/322482

描述不完整

请尽可能补充更多的信息,一步步告诉别人你做了什么,以便别人复现你的问题...

例如:

由于siunitxphysics宏包冲突报错,故删去相关部分并停止使用physics宏包

具体删除了哪个文件的哪个部分,原先所谓「siunitxphysics宏包冲突报错」的报错信息是什么?

使用模板【非官方】天津大学的 LaTeX 试卷模板编写试卷

你贴的链接需要20积分下载,这意味着每个想回答问题的人都得花20积分,这对潜在的回答者不友好...

报错信息如下图,具体表现为无法编译文件,无法生成*.log*.toc*.aux等文件。

你图示的报错信息是从清除辅助文件开始的,并不完整,如有可能,应该补充完整。

但修改后仍无法编译文件,且重新下载原模板并打开也无法编译。

在重新编译的时候你是否删除了全部中间辅助文件再开始(?)


另外,不知为什么,我从链接处下载的文件中的设置文件名为:TJ-exam-8kai-settings.tex

而在TJ-exam-8kai.tex中的第二行却只有\input{settings}

\documentclass[AutoFakeBold,twocolumn,zihao=-4,UTF8,answers]{ctexart} % 
% \input{settings} 
\input{TJ-exam-8kai-settings}% 我做的替换

这点你完全没提到,情况是相同的吗?


由于latexmk会自动执行多个编译命令,只是方便了运行,但是不方便debug. 所以最好依次执行xelatex等一系列命令查看报错信息.

在windows11+TL2025上使用xelatex TJ-exam-8kai.tex编译上面的代码是可以得到.log的(不知道为什么.log上传不了...):

注意其中最后几行:

% Line 1497  TJ-exam-8kai.log
[2]
! Emergency stop.
<inserted text> }\endwrite 
                           
l.109 \end{document}
                    
Unbalanced write command

且此时是可以顺利得到PDF文件的:

image.png

至此,问题的关键是找到为何会出现Unbalanced write command...


进一步简化问题:

\documentclass[AutoFakeBold,twocolumn,zihao=-4,UTF8]{ctexart}% 
% \input{settings} 
% \input{TJ-exam-8kai-settings}
\begin{document} 
  
\section{\textbf{填空题}(aaa)}

\end{document}

! Emergency stop.<inserted text> }\endwrite报错

但是

\documentclass[AutoFakeBold,twocolumn,zihao=-4,UTF8]{ctexart}% 
% \input{settings} 
\input{TJ-exam-8kai-settings}
\begin{document} 
  
\section{\textbf{填空题}(aaa)}

\end{document}

则会出现上述报错,至此TJ-exam-8kai-settings.tex中必定有问题.

稍微做一些简化,你可以把代码删减到:

\documentclass{ctexart}% 
\ctexset{section={number = \bfseries\chinese{section}}}
\usepackage{zref-lastpage}
\begin{document} 
  
\section{\textbf{填空题}hello}

你好!

\end{document}

同样会得到:

[1]
! Emergency stop.
<inserted text> }\endwrite

l.10 \end{document}

的问题...

image.png

事实上这里没必要用\bfseries,可以把TJ-exam-8kai-settings.tex中的

\ctexset{section={
        name = {,、\hspace*{-5mm}},
        number = \bfseries\chinese{section},
        format = {\zihao{-4}},
        beforeskip = 9pt,
        afterskip = 4pt
       }}

修改为

\ctexset{section={
        name = {,、\hspace*{-5mm}},
        number = \chinese{section},
        format = {\zihao{-4}},
        beforeskip = 9pt,
        afterskip = 4pt
       }}

既可以避免上述的问题。

另外,这个模板并不新,真的一定要用吗?!


BTW, 还要注意到这个模板似乎是13-14年写的,tasks包还报了如下的一个警告:

Package tasks Warning: You've tried setting command `\NewTasks ' on line 56.
(tasks)                However, command `\NewTasks ' is deprecated. Please use
(tasks)                command `\NewTasksEnvironment ' instead. Refer to the
(tasks)                manual for details.

自己做修改,留做习题....

具体是什么问题,两者有什么差异,请尽可能详细描述

不要只是提供几个代码片段让别人做猜测...


Edit

似乎 是因为.sty中 会默认启用expl3环境,因此_会被转义...

% MyTemplate.sty
%==============  MyTemplate.sty  ==============%
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\ProvidesExplPackage{MyTemplate}{2025-09-21}{1.1}{My personal utility macros}
% \NewDocumentCommand{\comb}{m m}{\mathrm{C}_{#1}^{#2}}% 这样写显示效果会有问题
\NewDocumentCommand{\comb}{m m}{\mathrm{C}\sp{#2}\sb{#1}} 

\endinput
% main.tex
\documentclass{article}
\usepackage{MyTemplate}
\begin{document}

before $\comb{n}{i}$ after

\end{document}

image.png

Ref: https://tex.stackexchange.com/a/698751/322482

虽然有一些神秘的baseline微调...

\documentclass{article}
\usepackage{fourier}
\usepackage{amsmath}
\usepackage{nicematrix}
\usepackage{tikz}
\usepackage{lipsum}
\begin{document}

\lipsum[2]

\[
R_o = 
\begin{bNiceArray}{ccc}[margin,last-row]
    \begin{tikzpicture}
    \clip (-.75,-.25) rectangle (1,3);
    \draw 
    (-.45,0) -- ++(0,2.25)
    (0.0,0) -- ++(0,2.25)
    node[above] {$K$}
    (+.45,0) -- ++(0,2.25);
    \end{tikzpicture}
    & 
    \begin{tikzpicture}[baseline=-1.25cm]
    \draw 
    (0,0) rectangle (1.5,1.5)
    (.75,1.5) node[above] {$K$}
    (1.5,.75) node[right] {$K$}
    ;
    \end{tikzpicture}
    & 
    \begin{tikzpicture}[baseline=-2cm]
    \draw 
    (0,-.5) --  ++(2,0)
    (0,0) -- ++(2,0) node[right] {$K$}
    (0,.5) -- node[midway,above] {$M$} ++(2,0);
    \end{tikzpicture} \\
    \mathbf{S} 
    & 
    % \mathbb{E}(\mathbf{a}\mathbf{a}^H) 
    \tikz[baseline=5.5ex]{
        \node (O) {non-singular};
        \node at (0,1) {$\mathbb{E}(\mathbf{a}\mathbf{a}^H) $}edge[latex-] (O.north);
    }
    &
    \mathbf{S}^H
\end{bNiceArray}
\]

\lipsum[2]

\end{document}

image.png

发布
问题