LaTeXStudio.net 问答 RSS 最新问答 https://ask.latexstudio.net/addons/ask/rss/index Wed, 03 Dec 2025 07:27:13 +0800 为什么不能顺利绑定手机?一直点不到正确位置? 为什么不能顺利绑定手机?一直点不到正确位置?19843945548

]]>
https://ask.latexstudio.net/ask/question/17968.html Mon, 01 Dec 2025 19:58:36 +0800
circuitikz宏包绘制滑动电阻问题及微调元件位置 老师们好!请教一个绘制滑动电阻的问题及微调元件位置,要绘制的图片效果如下: PixPin_2025-11-30_19-53-41.jpg

目前绘制的效果如下: PixPin_2025-11-30_19-57-15.jpg

代码如下:

\documentclass{ctexbook}
\usepackage{circuitikz}

\begin{document}

\begin{circuitikz}[european]
    \draw(0,0)to[rmeter,t=A](0,2)to[R,l_=$R$](3,2)to[pR,l_=$R'$,n=pr](5,2);
    \draw(0,0)to[normal open switch](6,0)|-(pr.wiper);
\end{circuitikz}

\end{document}

不知道去除多余的线,不知道怎么调元件的位置。

]]>
https://ask.latexstudio.net/ask/question/17966.html Sun, 30 Nov 2025 19:58:35 +0800
使用exam-zh模板在windows下编译\subject命令出现字体警告?
  • win11
  • texlive2025
  • vscode
  • xelatex
  • \documentclass{exam-zh}
    \begin{document}
    % 设置试卷标题和科目
    \title{数学测试}
    \subject{数学}
    \maketitle
    % 第一道选择题
    \begin{question}
    $1 + 1 = $ \paren[C]
    \end{question}
    \end{document}

    取消\subject{},没有报错。

    LaTeX Font: Font shape `TU/SimHei(0)/b/n' undefined
    (Font)  using `TU/SimHei(0)/m/n' instead.

    不知道是什么原因,就是想解决他。

    ]]>
    https://ask.latexstudio.net/ask/question/17964.html Sat, 29 Nov 2025 09:57:50 +0800
    关于ieeecolor模板参考文献中缺少doi的问题 如下链接给出的「ieeecolor模板」Alternate-Transactions-Articles-LaTeX-template2.zip 中,使用了「ieeecolor」文档类,现在考虑如下的MWE:

    \documentclass[journal,twoside,web]{ieeecolor}
    \usepackage{generic}
    \usepackage{cite}
    \begin{filecontents*}[overwrite]{refs.bib}
    @article{mahon2017sg,
      title = {{The {5G} effect on {RF} filter technologies}},
      volume = {30},
      number = {4},
      journal = {{IEEE Transactions on Semiconductor Manufacturing}},
      author = {Mahon, Steven},
      year = {2017},
      pages = {494--499},
      doi={10.1109/TSM.2017.2757879},
    }
    @article{lee2018spectrum,
      title = {{Spectrum for {5G}: {Global} status, challenges, and enabling technologies}},
      volume = {56},
      number = {3},
      journal = {{IEEE Communications Magazine}},
      author = {Lee, Juho and Tejedor, Erika and Ranta-aho, Karri and Wang, Hu and Lee, Kyung-Tak and Semaan, Eliane and Mohyeldin, Eman and Song, Juyeon and Bergljung, Christian and Jung, Sangyeob},
      year = {2018},
      pages = {12--18},
      doi={10.1109/MCOM.2018.1700818},
    }
    \end{filecontents*}
    \bibliographystyle{IEEEtran}
    \begin{document}
    
    Hello world\cite{mahon2017sg} ahahahha\cite{lee2018spectrum} ahaha!
    
    \bibliography{refs}
    
    \end{document}

    这将得到:

    image.png

    但现在编辑要求在参考文献列表中增加「DOI」的字段信息,在当前的模板和.bib的框架下,满足编辑这一需求的最佳实践是什么?

    Edit

    需要指出的是,在上述链接里使用的模板根本没有考虑「DOI」的问题,但是编辑却要你考虑。

    这本身就是个非常不合理的要求!!!

    不是(不能、也不应该)让所有的投稿者都是「bibtex」砖家(至少我不是)


    Edit

    注意到在ieeecolor.cls的3694行前后重定义了bibliography文档类:

    % ieeecolor.cls % line 3694
    \def\thebibliography#1{\section*{References\color{black}}%
        \addcontentsline{toc}{section}{References}%
        % V1.6 add some rubber space here and provide a command trigger
        \footnotesize \vskip 0.3\baselineskip plus 0.1\baselineskip minus 0.1\baselineskip%
        \list{\@biblabel{\@arabic\c@enumiv}}%
        {\settowidth\labelwidth{\@biblabel{#1}}%
        \leftmargin\labelwidth
        \advance\leftmargin\labelsep\relax
        \itemsep 0pt plus .5pt\relax%
        \usecounter{enumiv}%
        \let\p@enumiv\@empty
        \renewcommand\theenumiv{\@arabic\c@enumiv}}%
        \let\@IEEElatexbibitem\bibitem%
        \def\bibitem{\@IEEEbibitemprefix\@IEEElatexbibitem}%
    \def\newblock{\hskip .11em plus .33em minus .07em}%
    % originally:
    %   \sloppy\clubpenalty4000\widowpenalty4000%
    % by adding the \interlinepenalty here, we make it more
    % difficult, but not impossible, for LaTeX to break within a reference.
    % IEEE almost never breaks a reference (but they do it more often with
    % technotes). You may get an underfull vbox warning around the bibliography, 
    % but the final result will be much more like what IEEE will publish. 
    % MDS 11/2000
    \if@technote\sloppy\clubpenalty4000\widowpenalty4000\interlinepenalty100%
    \else\sloppy\clubpenalty4000\widowpenalty4000\interlinepenalty500\fi%
        \sfcode`\.=1000\relax}
    \let\endthebibliography=\endlist

    且在示例文件generic-color.tex中使用的是「thebibliography」环境而非「bib文件」的引用方式,直接使用IEEEtran文档类提供的IEEEtran.bst在这个投稿情景中是否合适/严格符合其样式要求,也是一个值得商榷的问题。

    ]]>
    https://ask.latexstudio.net/ask/question/17963.html Fri, 28 Nov 2025 13:21:13 +0800
    想问一下如何在居右的情况下,转行后“这”与“需”对齐 QQ20251128-101716.png

    \documentclass{ctexbook}
    \usepackage{titlesec,color,calc}
    
    \newcommand{\HZSBH}{\sffamily\bfseries\Large}
    \newcommand{\HYXSQS}{}
    
    \newlength{\chapterhang}
    
    \titleformat{\chapter}[hang]
      {\raggedleft\HZSBH\HYXSQS\color[cmyk]{1,1,0,0}}
      {第\thechapter 章}
      {1em}
      {\setlength{\chapterhang}{\widthof{第\thechapter 章}+1em}% 改动:+3em
       \makebox[0pt][r]{%
         \parbox[t]{\dimexpr\linewidth-\chapterhang-1em\relax}{%
           \setlength{\parindent}{0pt}%
           \parshape=2
             0pt \hsize
             \chapterhang \dimexpr\hsize-\chapterhang\relax
         }}}
    
    \titlespacing{\chapter}{0mm}{-6mm}{30mm}
    
    \begin{document}
    \chapter{这是一个很长的章节标题\\ 需要自动换行}
    \chapter{TCP服装参数优化}
    \end{document}
    ]]>
    https://ask.latexstudio.net/ask/question/17962.html Fri, 28 Nov 2025 10:19:22 +0800
    TeXstudio中无法使用asymptote来绘图 我准备在TeXstudio中使用asymptote来绘图。但pdf中无生成的图片。 Latex代码如下:

    \documentclass{article}
    \usepackage[pdftex]{graphicx}
    \usepackage{asymptote}
    \begin{document}
        Hello.  
        I like to make pics with Asymptote like this one:
        \begin{figure}[h]
            \begin{asy}
            import graph;
            size(1inch);
            filldraw(circle((0,0),1),yellow,black);
            fill(circle((-.3,.4),.1),black);
            fill(circle((.3,.4),.1),black);
            draw(arc((0,0),.5,-140,-40));
            \end{asy}
        \end{figure}
        \par It makes me happy, 
        since I can still type my normal LaTeX stuff around it: 
        \(\int_0^{\pi}{\sin{x}}\,dx=2\)
    \end{document}

    如果编译成功,pdf应为这样: 1.png

    但我用自己的TeXstudio编译,asymptote的图却无法显示. 2.png

    在文件夹中生成了一个.Asy文件 3.png

    打开这个.Asy的文档,里面内容如下:

    if(!settings.multipleView) settings.batchView=false;
    settings.tex="pdflatex";
    defaultfilename="例1-1";
    if(settings.render < 0) settings.render=4;
    settings.outformat="";
    settings.inlineimage=true;
    settings.embed=true;
    settings.toolbar=false;
    viewportmargin=(2,2);
    
    import graph;
    size(1inch);
    filldraw(circle((0,0),1),yellow,black);
    fill(circle((-.3,.4),.1),black);
    fill(circle((.3,.4),.1),black);
    draw(arc((0,0),.5,-140,-40));
    

    求助大佬,有什么建议和解决方法吗?非常感谢

    ]]>
    https://ask.latexstudio.net/ask/question/17959.html Mon, 17 Nov 2025 23:38:59 +0800
    使用 `tabularray` 绘制 `uml` 类图,如何控制`相对坐标`绘制直线的位置? 操作系统: Windows 11

    发行版: TeX Live 2025

    使用 Tabularray 绘制 uml 类图,我想出了两种方案

    • 将表格放在 node 节点里面, 使用 tikz 绘制直线

      \documentclass[tikz,border=10pt]{standalone}
      \usepackage{tabularray}
      \UseTblrLibrary{tikz}
      \usetikzlibrary{patterns,positioning}
      \begin{document}
      \begin{tikzpicture}[every node/.style = {inner sep=0pt}]
      \node (Circular)
      {
      \begin{tblr}{colspec={l},rowspec={cll}, row{1}={font=\bfseries},vlines,hlines}
      Circular \\
      bottom: Circle \\
      setBottom (Circle): void \\
      \end{tblr}
      };
      \node (Circle) [right=1cm of Circular]%
      {
      \begin{tblr}{colspec={l},rowspec={cll},row{1}={font=\bfseries},vlines,hlines}
      Circle \\
      radius: double \\
      getArea(): double \\
      \end{tblr}
      };
      
      \draw[->,red,thick] (Circular.east)--(Circle.west);
      \end{tikzpicture}
      \end{document}

      image.png

    • 使用 tabularray 的实验性库 tikz, 将两个类图放在同一张表格里,使用单元格节点控制直线的位置(这个方案目前看来最简单, 但由于拓展性不强放弃了(如果需要调整多个绘图代码,则需要反复调整表格的布局))

      \documentclass[border=10pt]{standalone}
      \usepackage{tabularray}
      \UseTblrLibrary{tikz}
      \usetikzlibrary{patterns,positioning}
      \begin{document}
      \begin{tblrtikzabove}
      \draw[thick,red,->] (1-1.mid east)--(1-3.mid west);
      \end{tblrtikzabove}
      \begin{tblr}{colspec={lQ[2cm]l},rowspec={cll}, row{1}={font=\bfseries},vlines,hlines={1,3}{solid}}
      Circular & & Circle \\
      bottom: Circle & & radius: double \\
      setBottom (Circle): void & & getArea(): double \\
      \end{tblr}
      \end{document}

      image.png

    问题:

    在第一个方案中如何控制相对坐标绘制的直线:

    \draw[->,red,thick] (Circular.east)--(Circle.west);

    (使用 shift 选项无效!!)

    ]]>
    https://ask.latexstudio.net/ask/question/17957.html Sun, 16 Nov 2025 08:18:15 +0800
    顶部导航条如何使用section短标题 在beamer中的使用“\insertshortsectionnavigationhorizontal{\textwidth}{}{}”插入section标题导航,现在section标题太长,且不可更改,如何使用section的短标题设置导航条?

    ]]>
    https://ask.latexstudio.net/ask/question/17956.html Sat, 15 Nov 2025 22:23:38 +0800
    在alogorithm2e宏包中如何设置`While`后的关键字为宋体/罗马正体? 如题,下面的mwe:

    \documentclass[fontset=fandol]{ctexart}
    \usepackage{graphicx} % Required for inserting images
    \usepackage[ruled,vlined,linesnumbered]{algorithm2e}
     \usepackage{amsmath}
    \title{试验}
    \author{834640568 }
    \date{July 2025}
    
    \begin{document}
    
    \maketitle
    
    \section{Introduction}
    
    \begin{algorithm}[htb]%算法3.1
    \caption{p-VQD算法}
    \label{algo:3.1} % 自动编号,可通过 \ref{algo:algorithm} 引用
    \small
    \SetAlgoLined
    \KwData{哈密顿量 $H$, 时间步长 $\Delta t$,时间步数$n$,初态$|\psi_0 \rangle$,梯度范数阈值$\text{grad}_{\text{tol}}$,迭代次数上限$\text{count}_\text{{max}}$,依赖参数$\theta$的量子电路$U(\theta)$}
    \KwResult{每个时间步的参数$\theta$}
        \For{第$1,2,\dots,n$个时间步}{
        对上一步的态$|\psi(\theta_t) \rangle$作用时间演化算子$e^{-iH\Delta t}$,得参照态$e^{-iH\Delta t}|\psi(\theta_t) \rangle$ \;
        初始化$\theta = \theta_t$\;%重复步骤3-8\;
        求惩罚函数的梯度$\nabla_{\theta}C(\theta)$     \;
        \While{\text{$|\nabla_{\theta}C(\theta)| > \text{grad}_{\text{tol}}$ \text{且} $\text{count} < count_{\text{max}}$}}{
        根据梯度$\nabla_{\theta}C(\theta)$,利用ADAM优化器更新参数$\theta$  \;
        $\text{count}$加1   \;
        求惩罚函数的梯度$\nabla_{\theta}C(\theta)$     \;
        }
    }  
    \end{algorithm}
    
    \end{document}

    但是这里的字体为斜体,希望修改为罗马正体。

    ]]>
    https://ask.latexstudio.net/ask/question/17953.html Tue, 11 Nov 2025 19:31:56 +0800
    在elegantbook模板中如何修改「proof」命令为带编号的形式? 如题,现在希望「proof」环境带编号:

    image.png

    MWE:

    \documentclass[lang=cn]{elegantbook}
    \usepackage{zhlipsum}
    \begin{document}
    
    \begin{proof}[(2)]
        显然。这是一个证明:\zhlipsum[2]。
    \end{proof}
    
    \end{document}

    image.png

    ]]>
    https://ask.latexstudio.net/ask/question/17952.html Tue, 11 Nov 2025 13:05:26 +0800
    elegantbook中的lang=cn对\bibname的覆盖失效? 如题,考虑如下MWE:

    \documentclass[
        lang=cn,fontset=fandol,
    ]{elegantbook}
    \geometry{paperheight=8cm}
    \addbibresource{xampl.bib}
    % \AtBeginDocument{%
    %     \renewcommand{\bibname}{参考文献}
    % }
    \begin{document}
    
    \chapter{第一章}
    Hello\cite{article-minimal} World! 中文!
    
    \printbibliography
    
    % \printbibliography[title={参考文献}]
    
    \end{document}

    elegantbook.cls模板中,上述代码表现为:

    image.png

    注意到在elegantbook.cls中的:

    % Line 21
    \DeclareStringOption[en]{lang}

    设置了默认值为lang=en

    且有:

    % Line 411
    \ifdefstring{\ELEGANT@lang}{cn}{
      \renewcommand{\baselinestretch}{1.3}
      \renewcommand{\contentsname}{目录}
      \renewcommand{\figurename}{图}
      \renewcommand{\tablename}{表}
      \renewcommand{\partname}{\color{structurecolor}}
      \renewcommand{\thepart}{第\zhnumber{\arabic{part}}部分}
      \renewcommand{\listfigurename}{插图目录}
      \renewcommand{\listtablename}{表格目录}
      \renewcommand{\bibname}{参考文献}
      \newcommand{\ebibname}{参考文献}
      \renewcommand{\appendixname}{附录}
      \renewcommand{\appendixtocname}{附录}
      \renewcommand{\indexname}{索\hspace{2em}引}
      \newcommand\figref[1]{\textbf{图}~\ref{#1}}
      \newcommand\tabref[1]{\textbf{表}~\ref{#1}}
      \newcommand{\authorname}{\citshape 作者:}
      \newcommand{\institutename}{\citshape 组织:}
      \newcommand{\datename}{\citshape 时间:}
      \newcommand{\versionname}{\citshape 版本:}
      \newcommand{\notename}{笔记}
      \renewcommand*{\proofname}{证明}
      \newcommand{\definitionname}{定义}
      \newcommand{\theoremname}{定理}
      \newcommand{\axiomname}{公理}
      \newcommand{\postulatename}{公设}
      \newcommand{\lemmaname}{引理}
      \newcommand{\propositionname}{命题}
      \newcommand{\corollaryname}{推论}
      \newcommand{\examplename}{例题} %
      \newcommand{\instancename}{示例} %
      \newcommand{\problemname}{问题} % 问题
      \newcommand{\exercisename}{练习} % 练习=习题
      \newcommand{\remarkname}{注}
      \newcommand{\assumptionname}{假设}
      \newcommand{\conclusionname}{结论}
      \newcommand{\solutionname}{解}
      \newcommand{\propertyname}{性质}
      \newcommand{\introductionname}{内容提要}
      \newcommand\bioinfo[2]{\gdef\@bioinfo{{\citshape #1}:#2}}
      \newcommand{\updatename}{更新:}
      \newcommand{\historyname}{版本更新历史}
      \newcommand{\beforechap}{第}
      \newcommand{\afterchap}{章}
    }{\relax}

    但在MWE中的表现却为:

    • \chaptername正确更改
    • \bibname并未正确更改

    这是不是elegant-latex在lang=cn时的非预期行为呢?


    BTW,使用:

    \printbibliography[title={参考文献}]

    或者

    \AtBeginDocument{%
        \renewcommand{\bibname}{参考文献}
    }

    都能满足需求,但不是问题的关键。

    Edited:

    使用意大利语方案lang=it,似乎一切正常...

    \documentclass[lang=it]{elegantbook}
    \geometry{paperheight=8cm}
    \addbibresource{xampl.bib}
    \begin{document}
    \chapter{Chapter Name}
    Hello\cite{article-minimal} World! 
    
    \printbibliography
    \end{document}

    image.png

    ]]>
    https://ask.latexstudio.net/ask/question/17951.html Mon, 10 Nov 2025 16:48:16 +0800
    这个模板我想把前面的这些无关内容删去 模板压缩包

    我都不知道我编译出来的pdf在哪个pdf ,而且我不想多余的部分image.png

    然后image.png

    这张图片里有一些小异常 想变成 image.png 符号完整 和 image.png 对齐

    ]]>
    https://ask.latexstudio.net/ask/question/17947.html Thu, 30 Oct 2025 18:15:24 +0800
    关于amsart修改permission页面样式的问题? 如下mwe:

    \documentclass[11pt]{amsart}
    
    \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

    现在的目标是要修改为:

    image.png

    ]]>
    https://ask.latexstudio.net/ask/question/17946.html Tue, 28 Oct 2025 19:29:12 +0800
    「elegantbook-latex日经问题」如何让「\chapter」页也正常显示页码? 如题,希望使用elegantbook模板实现让「\chapter」的首页也显示正常的页码?

    虽然这是book.cls文档类的默认行为,也是大多数book排版的惯例:

    % book.cls Line 350~354
    \newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                        \thispagestyle{plain}%
                        \global\@topnum\z@
                        \@afterindentfalse
                        \secdef\@chapter\@schapter}

    下面是MWE:

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

    image.png

    ]]>
    https://ask.latexstudio.net/ask/question/17944.html Sun, 26 Oct 2025 19:34:06 +0800
    标题与正文之间的距离调节没有反应怎么办? % 一级标题:第一章 绪论(对应\section) \titleformat{\section}[block] {% 字体设置 \centering % 居中对齐 \bfseries % 加粗 \fontsize{16pt}{16pt}\selectfont % 三号字(16pt),单倍行距 \CJKfontspec{SimHei}% 中文黑体 \fontspec{Times New Roman}% 西文Times New Roman } {\thesection}% 题序(如"第一章") {1\ccwd}% 题序与标题间空1个汉字宽度(1个空格) {}% 标题内容前无额外内容 {} \titlespacing{\section} {0pt}% 左缩进 {15.6pt}% 段前距离 {15.6pt}% 段后距离 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 二级标题:1.1 研究背景(对应\subsection) \titleformat{\subsection}[block] {% 字体设置 \raggedright % 左对齐 \bfseries % 加粗 \fontsize{14pt}{14pt}\selectfont % 四号字(14pt),单倍行距 \CJKfontspec{SimHei}% 中文黑体 \fontspec{Times New Roman}% 西文Times New Roman } {\thesubsection}% 题序(如"1.1") {1\ccwd}% 题序与标题间空1个汉字宽度(1个空格) {}% 标题内容前无额外内容 {} \titlespacing{\subsection} {0pt}% 左缩进 {9.1pt}% 段前距离 {9.1pt}% 段后距离 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %三级标题 % 2. 字体与样式(严格匹配要求) \titleformat{\subsubsection}[block] {% \raggedright % 左对齐(无缩进) \bfseries % 加粗 \fontsize{12pt}{12pt} % 小四号(12pt),单倍行距(标题自身行距=字号) \CJKfontspec{SimHei}% 中文黑体 \fontspec{Times New Roman}% 西文Times New Roman } {\thesubsubsection}% 题序(如"1.4.1") {1\ccwd}% 题序与标题间空1个汉字宽度(1个空格) {}% 标题内容前无额外内容 {} \titlespacing{\subsubsection} {0pt}% 左缩进(无) {8pt}% 段前0.5行(基于当前字体的行高) {8pt}% 段后0.5行 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %四级标题 % 四级标题完整配置(确保显示) % 四级标题完整配置(与三级标题一致) \newcounter{subsubsubsection}[subsubsection] \renewcommand{\thesubsubsubsection}{\arabic{section}.\arabic{subsection}.\arabic{subsubsubsection}.\arabic{subsubsubsection}} \titleformat{\subsubsubsection}[block] {% \raggedright \bfseries \fontsize{12pt}{15.6pt}\selectfont \CJKfontspec{SimHei} \fontspec{Times New Roman} } {\thesubsubsubsection} {1\ccwd} {} {} % 无额外命令 \titlespacing{\subsubsubsection} {0pt} {8pt}% 段前0.5行 {8pt}% 段后0.5行(固定值,与三级标题一致) % 简化自定义命令,移除强制行距 \newcommand{\subsubsubsection}[1]{% \par \refstepcounter{subsubsubsection}% {\raggedright\bfseries\fontsize{12pt}{15.6pt}\selectfont\CJKfontspec{SimHei}\fontspec{Times New Roman}% \thesubsubsubsection\hspace{1\ccwd}#1\par}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 创建独立正文环境(强制固定行距20磅) \newenvironment{maintext}{% \begingroup% 局部作用域,隔离外部设置 \interlinepenalty=0% 允许段落分页 \brokenpenalty=0% 允许段落跨页 \raggedbottom % 1. 核心:强制行距为20pt,不缩放 \linespread{1}\selectfont% 禁用行距缩放(关键!避免setspace宏包干扰) \fontsize{12pt}{20pt}\selectfont% 字号12pt,行距绑定为20pt(第二个参数直接控制\baselineskip) % 2. 锁定行距参数,不允许小于20pt \setlength{\baselineskip}{20pt}% 显式设置基线距为20pt(双重保障) \setlength{\lineskiplimit}{19.9pt}% 允许行距最小为19.9pt(仅比20pt小0.1pt,确保正文内强制20pt) \setlength{\lineskip}{20pt}% 多行环境(如列表、表格)强制行距20pt % 3. 正文格式设置 \justifying% 两端对齐 \setlength{\parskip}{0pt}% 段落间距0(避免干扰) \setlength{\parindent}{2em}% 首行缩进2字符 \frenchspacing% 取消句末额外空格 % 4. 确保表格内行距同步为20pt \AtBeginEnvironment{tabular}{\fontsize{12pt}{20pt}\selectfont\setlength{\baselineskip}{20pt}} % 5. 移除\everypar强制命令(避免干扰标题后第一个段落) }{% \endgroup% 结束局部作用域 } ]]> https://ask.latexstudio.net/ask/question/17943.html Sat, 25 Oct 2025 15:24:50 +0800 编译报错Cleaning failed: Latexmk: Error on first line of 'TJ-exam-8kai.log'. 系统:Windows 11 专业版 24H2 发行版本:TeX Live 2024 编译环境:VS Code

    问题:使用模板【非官方】天津大学的 LaTeX 试卷模板编写试卷时,由于siunitxphysics宏包冲突报错,故删去相关部分并停止使用physics宏包,但修改后仍无法编译文件,且重新下载原模板并打开也无法编译。报错信息如下图,具体表现为无法编译文件,无法生成*.log*.toc*.aux等文件。 补充:电脑上的其他*.tex文件均能正常编译

    PixPin_2025-10-21_15-55-35.png

    ]]>
    https://ask.latexstudio.net/ask/question/17942.html Tue, 21 Oct 2025 16:08:06 +0800
    tcolorbox 使用 minted 库排版代码, 实现目录报错 \tcblistof
  • 操作系统 Windows11
  • 发行版 TeX Live 2025
  • 编辑器 TeXstudio
  • 编译命令 XeLaTeX
  • mwe? 如下
    
    \documentclass[UTF8]{ctexbook}
    %代码排版
    \usepackage{tcolorbox}
    \tcbuselibrary{minted,breakable}
    \newtcblisting[auto counter,list inside=abMATLABlist]{abMATLAB}[3][]{%
      coltitle=black,
      colbacktitle=white,
      colupper=black,
      colback=white,
      boxrule=0pt,
      toprule=0.08em,
      titlerule=0.05em,
      bottomrule=0.08em,
      fonttitle=\bfseries,
      title={\heiti 代码列表 \thetcbcounter: #2},
      listing only,
      sharp corners=all,
      minted language=matlab,
      before={\begin{listing}[htbp!]},
      after={\label{#3}\end{listing}},
      #1,
    }
    \begin{document}
    \tableofcontents
    \tcblistof[\chapter*]{abMATLABlist}{MATLAB 代码}
    %\tcblistof[\section*]{abMATLABlist}{MATLAB 代码}
    %\begin{abMATLAB}{拉普拉斯展开计算行列式}{abMATLABlist:DetLaplace}
  • %\end{abMATLAB} \chapter{AAA} \begin{abMATLAB}{拉普拉斯展开计算行列式}{abMATLABlist:DetLaplace}

    \end{abMATLAB} \end{document}

    可供测试的一段 `MATLAB` 代码
    ```matlab
    function d=DetLaplace(A)
    % DETLAPLACE 使用 Lapace 展开计算行列式
    % d = DetLaplace(A); 计算矩阵 A 的行列式 (determinant)
    % 对第一行 (row) 使用 Laplace 展开 (expansion)
    n = length(A);
    if n==1
        d=A(1,1);
    else
        d=0; v=1;
        for j=1:n
            M1j = [A(2:n,1:j-1) A(2:n,j+1:n)];
            d = d + v*A(1,j)*DetLaplace(M1j);
            v = -v;
        end
    end
    • 需求
      • 使用 tcolorbox 中的 minted 库以及 \tcblistof (这可能不是好的方案) 实现 minted 宏包类 \listoflistings 排版代码目录的效果 (或许有没有进一步修改目录样式的方法)
      • 盒子的样式已经在代码中实现 image.png

    image.png

    • 报错信息如下: (可能的错误before={\begin{listing}[htbp!]},after={\label{#3}\end{listing}} , 有意思的是在下面的代码中
      
      \tcblistof[\chapter*]{abMATLABlist}{MATLAB 代码}
      %\begin{abMATLAB}{拉普拉斯展开计算行列式}{abMATLABlist:DetLaplace}

    %\end{abMATLAB} \chapter{AAA} \begin{abMATLAB}{拉普拉斯展开计算行列式}{abMATLABlist:DetLaplace}

    \end{abMATLAB}

    注释掉下面一段代码 `abMATLAB` 环境, 然后取消上面的 `abMATLAB` 的注释却能正常编译)

    ! Extra }, or forgotten \endgroup. \@endfloatbox ...pagefalse \outer@nobreak \egroup \color@endbox l.37 \end{abMATLAB}

    I've deleted a group-closing symbol because it seems to be spurious, as in $x}$'. But perhaps the } is legitimate and you forgot something else, as in\hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing `I$}'.

    ! Extra }, or forgotten \endgroup. \color@endbox ->\color@endgroup \egroup

    l.37 \end{abMATLAB}

    I've deleted a group-closing symbol because it seems to be spurious, as in $x}$'. But perhaps the } is legitimate and you forgot something else, as in\hbox{$x}'. In such cases the way to recover is to insert both the forgotten and the deleted material, e.g., by typing `I$}'.

    ! Undefined control sequence. \endlisting ...floatbox \global \setbox \@currbox \float@makebox \columnwidt... l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! Missing number, treated as zero.

    \vbox l.37 \end{abMATLAB}

    A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

    ! Undefined control sequence. \float@makebox ...ze =#1 \@parboxrestore \@fs@pre \@fs@iftopcapt \ifvoid \@f... l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! Undefined control sequence. \float@makebox ...restore \@fs@pre \@fs@iftopcapt \ifvoid \@floatcapt \else ... l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! Undefined control sequence. \float@makebox ... \@fs@mid \fi \unvbox \@currbox \else \unvbox \@currbox \i... l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! Extra \else. \float@makebox ...mid \fi \unvbox \@currbox \else \unvbox \@currbox \ifvoid ... l.37 \end{abMATLAB}

    I'm ignoring this; it doesn't match any \if.

    ! Missing number, treated as zero.

    \unvbox l.37 \end{abMATLAB}

    A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

    ! Undefined control sequence. \float@makebox ...currbox \else \unvbox \@currbox \ifvoid \@floatcapt \else ... l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! Extra \fi. \float@makebox ...mid \unvbox \@floatcapt \fi \fi \par \@fs@post \vskip \z@ } l.37 \end{abMATLAB}

    I'm ignoring this; it doesn't match any \if.

    ! Missing number, treated as zero.

    \scan_stop: l.37 \end{abMATLAB}

    A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

    ! Undefined control sequence. \float@makebox ...loatcapt \fi \fi \par \@fs@post \vskip \z@ } l.37 \end{abMATLAB}

    The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), typeI' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.

    ! LaTeX Error: \begin{tcolorbox} on input line 37 ended by \end{listing}.

    See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

    l.37 \end{abMATLAB}

    Your command was ignored. Type I to replace it with another command, or to continue without it.

    ! LaTeX Error: \begin{abMATLAB} on input line 35 ended by \end{tcb@drawing}.

    See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

    l.37 \end{abMATLAB}

    Your command was ignored. Type I to replace it with another command, or to continue without it.

    ! Missing number, treated as zero.

    \tcb@footnote@cnt@i l.37 \end{abMATLAB}

    A number should have been here; I inserted 0'. (If you can't figure out why I needed to see a number, look upweird error' in the index to The TeXbook.)

    ! LaTeX Error: \begin{document} ended by \end{tcolorbox}.

    See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

    l.37 \end{abMATLAB}

    Your command was ignored. Type I to replace it with another command, or to continue without it.

    ! Extra \endgroup. \end ...end#1\endcsname \@checkend {#1}\endgroup \UseHook {env/#1/after}\if... l.37 \end{abMATLAB}

    Things are pretty mixed up, but I think the worst is over.

    ! LaTeX Error: \begin{document} ended by \end{abMATLAB}.

    See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...

    l.37 \end{abMATLAB}

    Your command was ignored. Type I to replace it with another command, or to continue without it.

    ! Extra \endgroup. \end ...end#1\endcsname \@checkend {#1}\endgroup \UseHook {env/#1/after}\if... l.37 \end{abMATLAB}

    Things are pretty mixed up, but I think the worst is over.

    [5] (./test.aux)


    LaTeX2e <2025-06-01> patch level 1 L3 programming layer <2022/07/14>


    LaTeX Font Warning: Some font shapes were not available, defaults substituted.

    ) Here is how much of TeX's memory you used: 25260 strings out of 468389 635955 string characters out of 5444297 1101832 words of memory out of 5000000 53359 multiletter control sequences out of 15000+600000 630527 words of font info for 76 fonts, out of 8000000 for 9000 1348 hyphenation exceptions out of 8191 116i,6n,121p,514b,1091s stack positions out of 10000i,1000n,20000p,200000b,200000s

    Output written on test.pdf (5 pages).

    ]]>
    https://ask.latexstudio.net/ask/question/17941.html Mon, 20 Oct 2025 22:06:22 +0800
    我需要设置随机数生成的种子以确保文档中生成的内容每次编译都相同,怎么做? 我需要设置随机数生成的种子以确保文档中生成的内容每次编译都相同,怎么做?

    目前所用的宏是randques.sty,如附件所示。编译时用的代码是:

    \RandSelQuestions[random=10]{Ach12-a}

    randques.rar

    ]]>
    https://ask.latexstudio.net/ask/question/17937.html Fri, 10 Oct 2025 10:29:32 +0800
    pdflatex下如何使 texhigh 不打印「显式空格」? 请问在使用 pdflatex 编译时, texhigh 怎样不打印「显式空格」?我希望 texhigh 能在 pdflatex 下使用「不可见空格」。 image.png

    \documentclass{article} 
    \usepackage{texhigh} 
    \begin{document}
    \begin{texhigh}
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. 
    \end{texhigh}
    \end{document}
    ]]>
    https://ask.latexstudio.net/ask/question/17936.html Sat, 04 Oct 2025 00:51:31 +0800
    用TexLive2021版成功,新版本编译则目录中作者的格式会出错 https://www.latexstudio.net/index/details/index/mid/4546.html 网站上这个论文集模板编译失败!

    用TexLive2021版成功,新版本编译则目录中作者的格式出错

    Edited

    MWE的压缩包👉 20250605173859.zip

    ]]>
    https://ask.latexstudio.net/ask/question/17935.html Fri, 03 Oct 2025 11:26:44 +0800