LaTeXStudio.net 问答 RSS 最新问答 https://ask.latexstudio.net/addons/ask/rss/index Sat, 03 Jan 2026 08:08:54 +0800 如何将部分公式实现缩进? 2.png 怎么将最后两行公式缩进,实现与倒数第三行的等号对齐 最终效果应该是最后三行在同一条垂直线上

\begin{equation}
    \begin{aligned}
        \min _{a_{i}^{*}, a_{i}} \frac{1}{2} \sum_{i=1}^{n} \sum_{j=1}^{n} & \left(a_{i}^{*}-a_{i}\right)\left(a_{j}^{*}-a_{j}\right) \phi_{Z}\left(X_{i}\right)^{T} \phi_{Z}\left(X_{j}\right)-\sum_{i=1}^{n}\left[y_{i}\left(a_{i}^{*}-a_{i}\right)-\varepsilon\left(a_{i}^{*}+a_{i}\right)\right], \\
        \text { s.t. } \quad & \sum_{i=1}^{n}\left(a_{i}^{*}-a_{i}\right)=0, \\
        & 0 \leq a_{i}^{*}, a_{i} \leq C, \\
        & \phi_{Z}\left(X_{i}\right)^{T} \phi_{Z}\left(X_{j}\right)=\varphi\left(K_{D E K F}\left(X_{i}, Z\right)\right)^{T} \varphi\left(K_{D E K F}\left(X_{j}, Z\right)\right), \\
        & =\left\langle\varphi\left(K_{D E K F}\left(X_{i}, Z\right)\right), \varphi\left(K_{DEKF}\left(X_{j}, Z\right)\right)\right\rangle, \\
        & =K\left(K_{D E K F}\left(X_{i}, Z\right), K_{D E K F}\left(X_{j}, Z\right)\right),
    \end{aligned}
    \label{eq:6}
\end{equation}
]]>
https://ask.latexstudio.net/ask/question/17985.html Fri, 26 Dec 2025 16:44:26 +0800
模板历史版本问题 如何删除已发布模板的所有历史版本,只保留最新版本,防止用户错误下载旧版本导致格式不对的问题,而且用户进入历史版本页面无法勾选最新版本,可能造成误解

]]>
https://ask.latexstudio.net/ask/question/17981.html Thu, 25 Dec 2025 16:29:36 +0800
在elegantbook.cls的现有框架中,添加「cleveref」功能的最佳实践? 众所周知,在默认的fancy模式下的「定理类」环境基于tcolorbox实现:

具体代码可见:https://github.com/ElegantLaTeX/ElegantBook/blob/master/elegantbook.cls#L911-L1037

本问题的需求是:在不改变现有的frozen版本elegantbook.cls的前提下,希望给其增加「cleveref」功能。


一点探索:

既然elegantbook.cls是基于tcolorbox的,因此首先一定要先在tcolorbox里实现cleveref的功能。查阅文档得知,大约有两套方案:

  • 基于cleveref(2018年以来不再更新,经常与hyperref的功能起冲突)
  • 基于zref-clever

对于方案一:

一个最小例子如下:

\documentclass[12pt]{article} 
\usepackage[
    noheadfoot,
    margin=8mm,
    papersize={10cm,10cm},
]{geometry} 
\usepackage{cleveref}
\usepackage{tcolorbox}
\newtcolorbox[
    auto counter,
    number within=section,
    crefname={bluebox}{blueboxes}
]{mybluebox}[2][]{
    % label is label,% default value
    colback=blue!5!white,
    colframe=blue!75!black,
    fonttitle=\bfseries,
    title=Bluebox \thetcbcounter: #2,#1
}
\begin{document} 
\section{Blue}

\begin{mybluebox}[label={myreference}]{My title} 
This is an example.
\end{mybluebox}

\begin{mybluebox}[label={myreference2}]{My titletitle} 
This is an example.
\end{mybluebox}

\noindent
\Cref{myreference}, \cref{myreference}.\\ 
\Cpageref{myreference}, \cpageref{myreference}.\\ 
\nameCref{myreference}, \namecref{myreference}.\\ 
\labelcref{myreference}, \labelcpageref{myreference}.\\ 
\Cref{myreference2}, \cref{myreference2}\\
\Cref{myreference,myreference2}, \cref{myreference,myreference2}\\

\end{document}

image.png

对于方案二:

\documentclass[12pt]{article} 
\usepackage[
    noheadfoot,
    margin=8mm,
    papersize={10cm,10cm},
]{geometry} 
\usepackage{zref-clever}
\zcRefTypeSetup{mybluebox}{
    Name-sg = Bluebox , 
    name-sg = bluebox , 
    Name-pl = Blueboxes ,
    name-pl = blueboxes ,
}
\usepackage{tcolorbox}
\newtcolorbox[
    auto counter,
    number within=section,
]{mybluebox}[2][]{
    label type=mybluebox,
    colback=blue!5!white,
    colframe=blue!75!black,
    fonttitle=\bfseries,
    title=Bluebox \thetcbcounter: #2,#1
}
\begin{document} 
\section{Blue}

\begin{mybluebox}[label={myreference}]{My title} 
This is an example.
\end{mybluebox}

\begin{mybluebox}[label={myreference2}]{My titletitle} 
This is an example.
\end{mybluebox}

\noindent
\zcref{myreference}.\\ 
\zcpageref{myreference}.\\ 
\zcref[S]{myreference}.\\
\zcref[S]{myreference,myreference2}.\\
\zcref{myreference,myreference2}.\\

\end{document}

image.png


现在的核心问题是,由于elegantbook已经停止维护了,最好是在不改变elegantbook.cls(v4.5)当前架构的大前提下,在main.tex下通过类似/.append style或者覆盖现有配置等方式实现对「定理类环境」的「cleveref」功能。

image.png

由于在这里使用了共同的接口\ELEGANT@newtheorem,我个人感觉无论是:

image.png

  • 想在init options里传入cleverefcrefname选项
  • 或者想在类似thmstyle样式里加入label typezref-clever方案

都不太轻松...


一个可供测试的MWE如下:

注意这里的\documentclass{elegantbook}用的就是这个官方唯一指定的v4.5文件,不允许对.cls文件做任何修改

\documentclass[lang=cn,fontset=fandol]{elegantbook}
\geometry{paperheight=12cm}
\usepackage{cleveref}
% \usepackage{zref-clever}
% \zcRefTypeSetup{mytheorem}{Name-sg={定理},Name-pl={定理}}
% \zcRefTypeSetup{mylemma}{Name-sg={引理},Name-pl={引理}}

\begin{document}
\chapter{111}

\begin{theorem}{欧拉定理}{Euler}
    这是一个定理。
\end{theorem}

\cref{lem:Osbert} 

\cref{lem:Wong}

\cref{lem:Osbert,lem:Wong}

% \zcref{lem:Osbert} 

% \zcref{lem:Wong}

% \zcref{lem:Osbert,lem:Wong}

\chapter{222}

\begin{lemma}{Osbert引理}{Osbert}
    这是一个引理。
\end{lemma}

\begin{theorem}{欧几里得公理}{Euclide}
    这是另一个定理。
\end{theorem}

\cref{thm:Euler}

\cref{thm:Euclide} 

\cref{thm:Euler,thm:Euclide}

% \zcref{thm:Euler}

% \zcref{thm:Euclide} 

% \zcref{thm:Euler,thm:Euclide}

\chapter{333}
\begin{lemma}{Wong引理}{Wong}
    这是一个引理。
\end{lemma}

\end{document}

当然,也希望该功能可以加入2026年可能有希望短暂(复活)的elegantbook更新中....

]]>
https://ask.latexstudio.net/ask/question/17980.html Sun, 14 Dec 2025 14:39:31 +0800
footline用tikz画直线为什么最左边有空隙 请问为什么footline中用tikz画直线,最左边有空隙。尝试了\hspace{-1pt},overlay,remember picture这些办法可以,是否可以不用这些,使得左边没有空隙。以下是代码

\documentclass{ctexbeamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\setbeamertemplate{footline}{
   %\hspace*{-0.2pt}%
  \begin{tikzpicture}
    \def\r{1pt}
    \def\d{0.3pt}
    \coordinate (A) at (0,1.3em);
    \coordinate (B) at ($(A)+(0:{\paperwidth-(\r)-(\d)})$);
    \draw[red] (A)--(B);
    \fill[fill=white,line width=\d] (B) circle (\r);
    \node[anchor=south west,inner sep=0pt,outer sep=0pt,fill=red] at (0,0){\color{white}测试测试测试};
  \end{tikzpicture}
}
\begin{document}
\begin{frame}
  测试
\end{frame}
\end{document}

image.png

]]>
https://ask.latexstudio.net/ask/question/17977.html Thu, 11 Dec 2025 16:35:01 +0800
下载的国家标准模板编译出错 This compile didn’t produce a PDF. This can happen if: There is an unrecoverable LaTeX error. If there are LaTeX errors shown below or in the raw logs, please try to fix them and compile again. The document environment contains no content. If it’s empty, please add some content and compile again. This project contains a file called output.pdf. If that file exists, please rename it and compile again.

lightbulb Tip: Try to fix the first error and recompile. Often one error causes many later error messages. You can to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. Learn more

If you need to see the full logs, you can still download them or view the raw logs below.

]]>
https://ask.latexstudio.net/ask/question/17976.html Thu, 11 Dec 2025 14:40:52 +0800
如何实现这种带虚线的边框? cf64352b157d8e6b6f18c8356f12a4bd.png

想要复刻如图所示这种带虚线的边框和上下箭头,我的代码如下:

$\arraycolsep=1pt
\begin{array}{*1l@{\hskip\arraycolsep}c@{\hskip\arraycolsep}*{12}{>{\textstyle}l}}
x^3 & + & 2^3 & = (& x & + & 2) (& x^2 & - & x &\cdot& 2 & + & 2^2) \\
\bigg\updownarrow & & \bigg\updownarrow & & \bigg\updownarrow &  & \bigg\updownarrow & \bigg\updownarrow &  & \bigg\updownarrow & &\bigg\updownarrow & & \bigg\updownarrow \\
a^3 & + & b^3 & = (&a & + & b) (& a^2 & - & a&\cdot& b & + & b^2)
\end{array}$

实现效果

9c3c765118f431ca79b906a984c6b221.png

请教,如何实现带虚线的边框?

]]>
https://ask.latexstudio.net/ask/question/17974.html Mon, 08 Dec 2025 15:43:26 +0800
无法在 xeCJKfntef 宏包的 \CJKunderanyline* 命令中使用\zhlipsum 以及 \lisum 命令? 发行版texlive2025 编译命令:xelatex 问题\zhlipsum 以及 \lisum 命令无法使用 xeCJKfntef 宏包的 \CJKunderanyline* 命令?但 \newcommand\testtext 却可以在 \CJKunderanyline* 中使用 MWE: 如下

\documentclass{ctexart}
\usepackage{lipsum,zhlipsum}
\usepackage{xcolor}
\usepackage{xeCJKfntef}
\newcommand{\testtext}{我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。}
\begin{document}
\CJKunderanyline*{0.5ex}{\color{cyan!10}\rule{2pt}{2.5ex}}{\zhlipsum[1]}
\CJKunderanyline*{0.5ex}{\color{cyan!10}\rule{2pt}{2.5ex}}{\lipsum[1]}

\CJKunderanyline*{0.5ex}{\color{cyan!10}\rule{2pt}{2.5ex}}{\testtext}

\CJKunderanyline*{0.5ex}{\color{cyan!10}\rule{2pt}{2.5ex}}{我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。我能吞下玻璃而不伤身体。}
\end{document}

效果如下: image.png

]]>
https://ask.latexstudio.net/ask/question/17972.html Sat, 06 Dec 2025 08:34:19 +0800
行内盒子断行问题解决? 发行版:texlive2025overleaf) 编译方式:xelatex(或者 lualatex) 问题:想要在 elegantbook 文档类中实现行内盒子断行,但是 tcolorbox 行内盒子无法自动断行? 效果如下: image.png

盒子实现如下:

% 英文单词背景框(微调内边距,更舒展美观)
\newtcbox{\englishbox}{
    on line,
    boxrule=0pt,
    boxsep=1.5pt, % 盒内文字与边框的间距(比1pt舒展、比2pt紧凑)
    top=1pt,
    bottom=1pt,
    left=3pt, % 盒左侧内边距(比2pt更舒展)
    right=3pt, % 盒右侧内边距(比2pt更舒展)
    colback=cyan!10,
    colframe=cyan!10,
    arc=3pt,
    enhanced jigsaw
}

% 核心命令(保留你原有的写法)
\newcommand{\wordbox}[2]{%
    \englishbox{\textbf{#1}}% 
    \textcolor{blue!70!black}{(#2)}% 
}
]]>
https://ask.latexstudio.net/ask/question/17971.html Fri, 05 Dec 2025 22:57:35 +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」砖家(至少我不是)

    ]]>
    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