LaTeXStudio.net 问答 RSS 最新问答 https://ask.latexstudio.net/addons/ask/rss/index Thu, 26 Jun 2025 12:42:45 +0800 subequations环境实现含有子编号公式的对齐 我希望实现这样一种公式效果,主要是子编号和按等号对齐(下面两个等号应该像aligned环境一样可以对齐,不过好像在网页上用 不好弄出来):

    A = B + C         (1a)
D + E = F + G + H + I (1b)

我可以用

\begin{subequations}
    \begin{equation}
        A = B + C
    \end{equation}
    \begin{equation}
        D + E = F + G + H + I
    \end{equation}
\end{subequations}

来完成子编号,但这样好像不能实现对齐不同equation环境里的等式,请问有什么好的方法吗?

]]>
https://ask.latexstudio.net/ask/question/17815.html Wed, 25 Jun 2025 23:20:10 +0800
如何定制一个抄录内容超过1页时自动添加“续上页”标识的环境? 想要的效果: image.png 代码:

\documentclass{article}
\usepackage
    [papersize={10.5cm,14.85cm},
     centering,
     scale=.85,
    ]
    {geometry}
\usepackage{lipsum}
\usepackage{fancyvrb}
\pagestyle{empty}
\begin{document}
\begin{SaveVerbatim}{myverbatim}
\documentclass{article}
\usepackage
    [papersize={10.5cm,14.85cm},
     centering,
     scale=.85,
    ]
    {geometry}
\usepackage{lipsum}
\usepackage{fancyvrb}
\pagestyle{empty}
\begin{document}
\begin{Verbatim}
\title{title}
\author{author}
\date{date}
\maketitle
\section{section}
\lipsum[1]
\section{section}
\lipsum[1]
\end{document}
\end{Verbatim}
\end{SaveVerbatim}
\UseVerbatim{myverbatim}
\end{document}

额外的问题:上述抄录环境中如何将特定LaTeX代码\lipsum[1]先展开后抄录?

]]>
https://ask.latexstudio.net/ask/question/17813.html Mon, 23 Jun 2025 17:39:57 +0800
输出的PDF文档页面用「Adobe Acrobat」查看显示文字深浅不一,整体看有一坨坨的黑斑...... CTEXxeCJK宏包,以XeLaTeX编译的PDF文档,发现文档页面显示文字深浅不一,整体看有一坨坨的黑斑,如图所示。不知问题在哪?请大家指点,谢谢!

附中文字体设置:

\setCJKmainfont{NSimSun.ttf}[
    ItalicFont = simfang.ttf,
    BoldFont = FZXKTK.TTF,
    BoldItalicFont = STZHONGS.TTF,
    FallBack = simsunb.ttf
    ]

1.png

]]>
https://ask.latexstudio.net/ask/question/17810.html Sat, 21 Jun 2025 13:04:01 +0800
使用 LaTeX 的 cleveref 或相关宏包时,出现问题: \cref@override@label@type 使用不匹配 \documentclass[review,hidelinks,onefignum,onetabnum]{siamart220329} \usepackage{lipsum} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{graphicx} \usepackage{epstopdf} \usepackage{algorithmic} \usepackage{enumitem} \usepackage{booktabs} \usepackage{multirow} \usepackage{amsopn} \usepackage{bm} \ifpdf \DeclareGraphicsExtensions{.eps,.pdf,.png,.jpg} \else \DeclareGraphicsExtensions{.eps} \fi % Add a serial/Oxford comma by default. \newcommand{\creflastconjunction}{, and~} % Used for creating new theorem and remark environments \newsiamremark{remark}{Remark} \newsiamthm{exper}{Experiment} \newsiamremark{hypothesis}{Hypothesis} \crefname{hypothesis}{Hypothesis}{Hypotheses} \newsiamthm{claim}{Claim} ...

报错行

*
\begin{theorem}\label{thm1}
...
\end{theorem} 

后面接着的\begin{proof}也报错

上述两行报错提示为:

错误: 168: Use of \cref@override@label@type doesn't match its definition. \begin{theorem}
错误: 192: Use of \cref@override@label@type doesn't match its definition. \begin{proof}

但是编译出的pdf没有任何问题,就是一直报错?

求大神指点

]]>
https://ask.latexstudio.net/ask/question/17809.html Fri, 20 Jun 2025 11:45:51 +0800
Elegantbook 缺失字体 "The font "FZFangSong-Z02" cannot be found;"。 将 MiKTeX 换成 TeXlive2025 无法使用方正字体(似乎之前也没有使用方正字体字体,而是使用默认字体代替)

  1. 类似问题 一个困扰好久的字体报错问题,尝试了 fc-list
    • 字体信息文件为 font.txtzhfont.txt
    • 错误报告为 fasn.txt 以及 missfont.txt
    • 一个例子 fasn.tex
  2. 字体安装的是 elegantbook-cn 推荐的 font.zip(可通过 elegantbook-cn 中的字体)
  3. 全部宏包已使用 tlpkg 更新。
  4. 使用 XeLaTeX 编译,试过 LuaLaTeX 编译,log文件中也是使用默认字体代替方正字体。
  5. 附件example.zip
]]>
https://ask.latexstudio.net/ask/question/17808.html Wed, 18 Jun 2025 15:39:53 +0800
请问各位大佬,怎么才能实现图中的排版 微信图片_20250618103928.jpg

]]>
https://ask.latexstudio.net/ask/question/17807.html Wed, 18 Jun 2025 10:46:08 +0800
如何给题库中的题目打标签? 请教,有没有宏包可以实现给题库中的题目动态打标签的功能?

我有一些题目,每道题目需要打上1-4个不等的知识点标签,比如:

\begin{problem}
题目1

\tagit{标签1}{标签2}
\end{problem}

\begin{problem}
题目2

\tagit{标签1}{标签3}
\end{problem}

\begin{problem}
题目3

\tagit{标签1}{标签4}
\end{problem}

\begin{problem}
题目4

\tagit{标签2}{标签3}{标签4}
\end{problem}

然后希望能按照标签打印该标签下的所有题目到一个单独的tex文件中,

比如 \print_by_tag{标签1} 会打印出一个.tex文件包含

\begin{problem}
题目1

\tagit{标签1}{标签2}
\end{problem}

\begin{problem}
题目2

\tagit{标签1}{标签3}
\end{problem}

\begin{problem}
题目3

\tagit{标签1}{标签4}
\end{problem}

又比如 \print_by_tag{标签4} 会打印出一个.tex文件包含

\begin{problem}
题目3

\tagit{标签1}{标签4}
\end{problem}

\begin{problem}
题目4

\tagit{标签2}{标签3}{标签4}
\end{problem}
]]>
https://ask.latexstudio.net/ask/question/17806.html Mon, 16 Jun 2025 14:51:27 +0800
无法绑定手机号。 发送验证码时,始终无法点中正确区域。这是怎么回事?

]]>
https://ask.latexstudio.net/ask/question/17804.html Fri, 13 Jun 2025 18:20:35 +0800
想要输入左端的大括号,而且每个公式要有子编号? \textbf{OP5:} \begin{subequations}\label{op5} \begin{align} &\underset{u(k)}{\min}~ \psi \label{op51}\\ &s.t. ~~J_{\infty}(k) \leq \psi \label{op52}\\ &\xi(k+1|k)\in \Phi_{M+1}\label{op53}\\ &\underset{p}{\max}\left|\left[u(k)\right]_p\right|\leq \bar{u}, p\in \{1,\ldots,n_u\} \label{op54}\\ &\underset{q}{\max}\left|\left[x(k)\right]_q\right|\leq \bar{x}, q\in \{1,\ldots,n_x\} \label{op55} \end{align} \end{subequations}

微信截图_20250612084015.png

]]>
https://ask.latexstudio.net/ask/question/17803.html Thu, 12 Jun 2025 15:43:37 +0800
绑定手机,发送验证码,老是未点中正确区域!怎么回事? 绑定手机,发送验证码,老是未点中正确区域!

]]>
https://ask.latexstudio.net/ask/question/17800.html Sun, 08 Jun 2025 06:44:21 +0800
如何在LaTeX文档中插入pdf文档 我想将一个PDF文件插入到LaTeX生成的文档中。测试过如下方式,但一直失败 \documentclass[12pt,a4paper,openany]{ctexbook} \usepackage{pdfpages} \usepackage{zhlipsum} \begin{document} \chapter{如何插入PDF文件} \section{如何插入PDF文件} \zhlipsum[1-8] \includepdf[pages={1}]{1.pdf} \newpage \end{document}

提示如下错误: 微信截图_20250606145001.png

下面是想插入的pdf文件: MWE.rar

]]>
https://ask.latexstudio.net/ask/question/17799.html Fri, 06 Jun 2025 14:52:59 +0800
制作三线表的问题 这个三列元素的间隔如何能一样呢 看起来平衡 \documentclass{article} \usepackage{tabularx} % 需导入宏包 \usepackage{amsmath} \usepackage{booktabs} \begin{document} \begin{table}[!htbp] \centering \begin{tabularx}{\textwidth}{Xcc} % X为自动伸缩列,c为固定宽度列 \toprule[1.5pt] 符号 & 说明 & 单位\\ \midrule[1pt] 5 & 269.8 & 0.04089\\ 10 & 421.0 & 0.04089\\ 20 & 640.2 & 0.04089\\ \bottomrule[1.5pt] \end{tabularx} \label{tab:001} \end{table} \end{document} ]]> https://ask.latexstudio.net/ask/question/17797.html Wed, 04 Jun 2025 23:02:09 +0800 如何控制标题禁止出现在版心的垂直位置的极限位置? 下面这个标题,它出现在版心的垂直位置的极限位置如何控制? 例如,我想让一个标题禁止出现在版心靠下80%的位置到版心底部之间的区域,似乎文档类article[或是(la)tex]有这方面的接口,(因为下图看上去,第一页还没排满,标题就已经去第二页了)但我不知道叫什么名字。

image.png

\documentclass{article}  
\usepackage[scale=.9, papersize={10.5cm, 14.85cm}, showframe]{geometry}
\begin{document} 

\ExplSyntaxOn
\int_step_inline:nn {55}{This\ is\ a\ new\ .tex\ document.\ }
\ExplSyntaxOff

\section{new section}

\ExplSyntaxOn
\int_step_inline:nn {2}{This\ is\ a\ new\ .tex\ document.\ }
\ExplSyntaxOff

\end{document} 
]]>
https://ask.latexstudio.net/ask/question/17795.html Tue, 03 Jun 2025 17:37:38 +0800
Asymptote绘图用latex编译不出来是哪里有问题??? \documentclass{article} \usepackage{asymptote} \begin{document} \begin{asy} size(200); picture pic; picture fig; filldraw(pic,unitcircle,green); filldraw(fig,unitsquare,red); // 将两个图形添加到当前画布,并指定位置 add(pic); // 默认位置 (0,0) add(shift(2,0)*fig); // 将红色正方形向右移动2个单位 \end{asy} \end{document}

编译完成了不出图像,是哪里有问题了?

]]>
https://ask.latexstudio.net/ask/question/17794.html Sun, 01 Jun 2025 21:46:33 +0800
为什么ctex宏集在pdflatex条件下生成的PDF,可以使用founder和windows系列的系统本地字体?是否可以模仿该行为,增加一个自定义的pdflatex下ctex宏集的中文字体配置策略? 使用下列代码:

\documentclass{article} 
\usepackage[fontset=founder, UTF8]{ctex} 
\usepackage[b6paper, scale=.9, landscape]{geometry}
\begin{document} 

This is a new .tex document. 

\songti 你好,世界!

\heiti 你好,世界!

\fangsong 你好,世界!

\kaishu 你好,世界!

\end{document} 

可以得到这个内容: image.png 可知这是由pdflatex生成的使用了founder系列字体的PDF文件。 众所周知,pdflatex没有调用系统本地字体的能力

  1. 那么这些汉字支持是怎么实现的?
  2. 是不是依靠...\texlive\2024\texmf-dist\tex\generic\ctex\zhmap下的ctex-zhmap-founder.tex文件实现的?
  3. 如果是,那么是否能够写一个与ctex-zhmap-founder.tex类似的文件,使ctex宏集支持用户自定义的中文字体配置策略,并在pdflatex条件下生效?例如,希望使用fontset=source选项,在pdflatex条件下,使生成的PDF能够显示本地的思源系列字体。
]]>
https://ask.latexstudio.net/ask/question/17793.html Fri, 30 May 2025 10:46:37 +0800
『未完全解决』想实现如下的渐变文字,当下使用LaTeX有哪些可能的实践? 目标:实现中英文的如下「文本渐变色」效果

image.png

在交流群搜罗到的一些解决方案:

Method1:

By 鱼香肉丝没有鱼先生@u19850

我拿l3写一个试试

\documentclass{ctexart}
\usepackage{xcolor}

\ExplSyntaxOn

% #1 start-color #2: end-color #3: text
\cs_new:Npn \__gradien_text:nnn #1#2#3 
{
    \tl_set:Nn \l_tmpa_tl { #3 }
    \int_set:Nn \l_tmpa_int { \tl_count:N \l_tmpa_tl }
    \int_step_inline:nn { \l_tmpa_int } {
        \textcolor{#2!\fp_eval:n{##1 * 100/\l_tmpa_int}!#1}{\tl_item:Nn \l_tmpa_tl {##1}}
        \allowbreak
    }
}

\NewDocumentCommand{\gradienttext}{mm+m}{\__gradien_text:nnn{#1}{#2}{#3}}
\ExplSyntaxOff

\begin{document}

\gradienttext{red}{blue}{劳仑衣普桑,认至将指点效则机,最你更枝。想极整月正进好志次回总般,段然取向使张规军证回,世市总李率英茄持伴。}

\end{document}

image.png

Method2:

用户「LaTex新手心态」给出的基于gradient-text的方案:

\documentclass{article}
\usepackage{gradient-text}
\begin{document}
\begin{center}
    {\Huge\bfseries
    \gradientRGB{ZHONGGUO GONGCHANDANG}{230,0,0}{135,0,0}
    \gradientRGB{WANSUI}{230,0,0}{135,0,0}\par
    }
\end{center}
\end{document}

image.png

小插曲:事实上,gradient-text内部实现和「Method1」如出一辙,均为「逐字渐变」

image.png

Method3:

同样是By 鱼香肉丝没有鱼先生 @u19850:

tikz,可以封装一下,小规模使用,不考虑换行,应该还行

\documentclass[margin=2cm]{standalone}
\usepackage{tikz,ctex}
\usetikzlibrary{decorations.text,math}
\begin{document}
\begin{tikzpicture}[
    decoration = {
        text effects along path,
        text = {劳仑衣普桑,认至将指点效则机,最你更枝。},
        text effects/.cd,
        character count=\i, character total=\n,
        characters = {
            text along path,
            evaluate = {\c=\i/\n*100;},
            text = orange!\c!blue, scale=1
        }
    }
]
\path [decorate] (0,0) to (8,0);
\end{tikzpicture}
\end{document}

image.png

需要指出的是,上述的实现均为「逐字渐变」,而非「真正意义上的渐变」

Method4: 雾月老师开发的texhigh宏包:

在其编译内容中使用效果可以实现真正的渐变:

image.png

问题:

由于暂缺texhigh的用户文档,目前我的测试举步维艰😭😭😭。实现「真正的文字渐变」的最佳实践是什么?是否有可能脱离「texhigh」提取出一个轻量级的命令?

]]>
https://ask.latexstudio.net/ask/question/17792.html Fri, 30 May 2025 00:40:35 +0800
文字字体采用textbf命令无法加粗 文字字体采用textbf命令无法加粗

QQ20250528-163229.pngDianLi_2025-05281Eng.zip

系统:Win11系统,VC code 编辑器,版本TeXLive2021.

]]>
https://ask.latexstudio.net/ask/question/17789.html Wed, 28 May 2025 16:40:37 +0800
五一杯数模竞赛论文模板(非官方)报错 我在网上下载的五一杯数学竞赛模板编译报错,不知道具体原因,请大佬们帮我看看!

附件一直上传不上来,就只好贴链接了,拜托了!

通过百度网盘分享的文件:五一建模竞赛模板… 链接:https://pan.baidu.com/s/1WmgCm9hQC1_g4Guv6HDMyw?pwd=13go  提取码:13go 复制这段内容打开「百度网盘APP 即可获取」

注:在font文件夹中有三个字体文件,可先为所有用户安装,以避免字体报错。

直接编译⌈五一模板.tex⌋的报错信息为:

! Package fontspec Error:
(fontspec)                The font "YaHei.Consolas.1.11b" cannot be found;
(fontspec)                this may be but usually is not a fontspec bug.
(fontspec)                Either there is a typo in the font name/file, the
(fontspec)                font is not installed (correctly), or there is a
(fontspec)                bug in the underlying font loading engine
(fontspec)                (XeTeX/luaotfload).

For immediate help type H <return>.
 ...

l.130 \newfontfamily
                    \monaco{MONACO.TTF}
?
]]>
https://ask.latexstudio.net/ask/question/17788.html Sun, 25 May 2025 14:24:11 +0800
xelatex编译用ctex包制作的tex文件时报错“Cannot use \XeTeXOTcountfeatures with nullfont”,怎么解决? 使用texlive 20253月8号的版本

tex文件内容

\documentclass{ctexart}
\begin{document}
你好 \LaTeX\ 世界!
\end{document}

错误:

ctex-fontset-windows.def: 错误: : Package fontspec Error:
ctex-fontset-windows.def: 错误: 101: Cannot use \XeTeXOTcountfeatures with nullfont; not an OpenType Layout font. }
ctex-fontset-windows.def: 错误: 101: Missing = inserted for \ifnum. }

win10 22h2 打了最新的更新

请问有什么解决办法吗?

完整的日志文件:

! Package fontspec Error: 
(fontspec)                The font "SimHei" cannot be found; this may be but
(fontspec)                usually is not a fontspec bug. Either there is a
(fontspec)                typo in the font name/file, the font is not
(fontspec)                installed (correctly), or there is a bug in the
(fontspec)                underlying font loading engine (XeTeX/luaotfload).

For immediate help type H <return>.
 ...                             
]]>
https://ask.latexstudio.net/ask/question/17787.html Sat, 24 May 2025 12:28:59 +0800
如何制作可跨页分栏的列表环境,使得标签顶格且标签宽度等于标签自身? 众所周知,列表环境分为项目符号和项目内容,例如LaTeX默认提供的enumerate环境,键入\item A,得到一个序号1和小数点的组合,一个字母A,以及一些空白距离,包括垂直的和水平的。略去这些空白距离,只谈“有效信息”,即序号和小数点的组合(项目符号)和字母A(项目内容),当项目内容较多的时候,就会产生悬挂效果,并且默认是支持换页和分栏的。

但是这里面有一些我不满意的点,参照enumitem宏包的图: image.png

  1. 标签盒子的宽度是预设置的,由此,其一,label默认是居右的,这就导致label盒子的左端留出些许水平空白,我想让label顶格,至少需要居左才行,这当然可以通过align=left来实现,此后显然是居左的,但是此时又导致其二,label盒子的右端可能留出许多空白。然而,实际上在label两边的水平空白,我都不想要,但仍然需要在label1.后面留出一些微不足道的水平空白,以将项目符号和项目内容分隔开。

  2. 剩下的部分是关于项目内容,只要其总宽度加上label的总宽度刚好等于版心宽度就满足了。当然前面说的标签顶格,意思大概就是说这段红框的水平长度:image.png刚好为0pt,看起来似乎是当itemindent=labelsep=0ptleftmargin-labelwidth的值。

  3. 当然,我希望可以换页和分栏。

  4. 标签可以自动计数吗?我想要它!而且最好可以灵活处理,毕竟有时候我想跳过一些数字或者重新开始计数

  5. 可以用诗歌verse环境实现吗?或者其他的封装方法?

一个效果图是这样:
efc62559cd8efe75c7f923433ef3b847.png 一个mwe像这样:
877f17bd7ac0e9bc0ec0cb1be7b63ba1.png

]]>
https://ask.latexstudio.net/ask/question/17786.html Mon, 19 May 2025 23:33:26 +0800