LaTeXStudio.net 问答 RSS 最新问答 https://ask.latexstudio.net/addons/ask/rss/index Fri, 15 May 2026 17:07:03 +0800 请问在MAC上用sublime(安装LatexTools插件)编辑tex文件时,如何配置makeglossaries 请问用sublime编辑tex文件时,如何配置makeglossariessublime调用进行词汇表编译?我查了下百度,说是在 sublime Text → tools → build system → new build system 进行配置,但是操作后还是不行。

百度AI给出的方法如下: 在 Sublime Text 中配置构建系统‌ 创建自定义 .sublime-build 文件,例如命名为 LaTeXWithGlossaries.sublime-build,内容如下:

{
    "cmd": ["latexmk", "-pdf", "-dvi-",
            "-jobname=${file_base_name}",
            "-synctex=1",
            "-interaction=nonstopmode",
            "${file}"],
    "file_regex": "^(...*?):([0-9]+):?([0-9]+):? (.*)$",
    "working_dir": "${file_path}",
    "selector": "text.tex.latex",
    "variants": [
        {
            "name": "Make Glossaries",
            "cmd": ["makeglossaries", "${file_base_name}"],
            "working_dir": "${file_path}"
        }
    ]
}

此配置使用 latexmk 自动处理编译流程(包括调用 makeglossaries),但若需手动触发,可通过 Tools → Build With… → Make Glossaries 执行。

]]>
https://ask.latexstudio.net/ask/question/18037.html Mon, 11 May 2026 20:52:52 +0800
使用times字体时单词 `Impedance` 无法自动调整断行点导致超出页面边界的神必问题? 如题,考虑如下MWE。 来自该死的某版本的 buaa.cls:

% xelatex
\RequirePackage[T1]{fontenc} 
\documentclass[zihao=-4]{ctexbook}
\RequirePackage[
    papersize={210mm,297mm},
    top=25mm,bottom=25mm,
    left=25mm,right=25mm,
    showframe
    ]{geometry} 
\RequirePackage{enumitem} 

\usepackage{txfonts}
% \usepackage{newtxtext}
\usepackage[T1]{fontenc}

\begin{document}

\begin{enumerate}[label={[}\arabic*{]}, labelindent=\parindent, leftmargin=*]
    \item Tao Y, \textbf{Liu H}, Wang X, et al. Probabilistically Informed Motion Primitives for Impedance Control with Guided Motion Planning in Contact-Rich Manipulation Tasks[J]. xxxx. (学生一作在投,SCI,Q1, IF=4.7,对应第四章)
\end{enumerate}

\end{document}

一些探索:

  • \RequirePackage[T1]{fontenc}应当是完全错误的用法 Refs
  • 使用\usepackage{newtxtext}似乎略有改善,但问题仍然存在
  • \usepackage[T1]{fontenc}影响该换行问题
]]>
https://ask.latexstudio.net/ask/question/18033.html Sat, 25 Apr 2026 22:38:33 +0800
吕教授经典《概率论与数理统计》、《数值计算方法》beamer 模版与1600 多页课件PDF 目前仍旧无法下载

]]>
https://ask.latexstudio.net/ask/question/18026.html Tue, 21 Apr 2026 16:43:38 +0800
系统 您下载了作品【吕教授经典《概率论与数理统计》、《数值计算方法》beamer 模版与1600 多页课件PDF】,消耗20个积分 积分扣除,但是无法下载文件

]]>
https://ask.latexstudio.net/ask/question/18024.html Sun, 19 Apr 2026 11:43:14 +0800
系统 您下载了作品【吕教授经典《概率论与数理统计》、《数值计算方法》beamer 模版与1600 多页课件PDF】,消耗20个积分 积分扣除,但是无法下载文件

]]>
https://ask.latexstudio.net/ask/question/18023.html Sun, 19 Apr 2026 11:43:08 +0800
Beamer目录用multicol不能对齐 请问为什么目录分列之后,顶部不能对齐,以下是代码

\documentclass{ctexbeamer}
\usepackage{multicol}
% 自定义颜色
\xdefinecolor{mycolor}{RGB}{0,102,204}
\begin{document}
{
\setbeamertemplate{headline}{}
\setbeamertemplate{footline}{}
\begin{frame}[plain]
    \vspace*{\fill}
    \centering
    % 标题
    {\Huge \bfseries \textcolor{mycolor}{目录}}%
    \vspace{1.2em}
    \textcolor{mycolor}{\hrule}
    \vspace{1.5em}
    \begin{minipage}{0.85\textwidth}
        \begin{multicols}{2}
            \tableofcontents[hideallsubsections]
        \end{multicols}
    \end{minipage}
\end{frame}
}
\section{第一章 研究背景}
\section{第二章 研究意义}
\section{第三章 研究内容}
\section{第四章 研究方法}
\section{第五章 技术路线}
\section{第六章 总结展望}

\begin{frame}
    正文
\end{frame}
\end{document}
]]>
https://ask.latexstudio.net/ask/question/18022.html Tue, 14 Apr 2026 12:31:08 +0800
为什么复旦大学数学年刊官网下载的latex都无法运行 为什么复旦大学数学年刊官网下载的latex都无法运行?

A辑模版-2017-8.rar

]]>
https://ask.latexstudio.net/ask/question/18021.html Fri, 03 Apr 2026 16:04:27 +0800
请教:使用`chemfig`宏包酚醛树脂的缩聚反应方程式如何写 使用chemfig宏包酚醛树脂的缩聚反应方程式如何写,达到图片上的效果,特别是方括号及高分子连线那部分。be0752731fa540f6146b46c48c9948b1.png

]]>
https://ask.latexstudio.net/ask/question/18018.html Mon, 30 Mar 2026 20:50:15 +0800
使用tabularray的X列格式控制宽度比例时如何同时允许自动换行? 下面这份基于tabularray的代码在不插入大段文字内容时表现还算良好:

\documentclass[12pt, a4paper]{article}
\usepackage[fontset=fandol]{ctex}
\usepackage[showframe,a4paper,hmargin=1.25cm]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{booktabs,varwidth}
\setlength{\parindent}{0pt}
\usepackage{lipsum}
\begin{document}

\begin{tblr}{
    colspec={X[1.25,c,m]X[1.75,c,m]X[1,c,m]X[1.5,c,m]X[1.75,c,m]},
    hlines,vlines,
    hline{1,Z} = {2pt},
    vline{1,Z} = {2pt},
    width=\linewidth,
    measure=vbox,
    rows = {ht=1cm},
    row{3} = {ht=2.5cm},
    row{X-Y} = {ht=3cm},
    cell{1}{1-Y} = {r=2}{valign=m},
    cell{2}{Z} = {r=3}{valign=m},
    cell{3}{2} = {c=3}{valign=m},
    cell{5-Z}{2} = {c=4}{halign=l,valign=m},
    cell{X-Y}{2} = {valign=h},
}
课程名称 & & {学\quad 分} & & {总计:\qquad 学时} \\
& & & & {\linespread{1.75}\selectfont 讲课:\qquad 学时\\讲课:\qquad 学时\\讲课:\qquad 学时\\讲课:\qquad 学时\\讲课:\qquad 学时\\} \\
{课程性质\\[10pt](请打勾)} & %
{\linespread{1.5}\selectfont%<- important % hete
    通识必修课(\quad)\ 通识选修课(\quad)\ 专业必修课(\quad)\\
    通识必修课(\quad)\ 通识选修课(\quad)\ 专业必修课(\quad)\\
    通识必修课(\quad)\ 通识选修课(\quad)\ 专业必修课(\quad)\\
}  
&  &  &  \\
任课老师 &  & 职称 &  &  \\
授课对象 & 年级、专业: &  &  &  \\
课程目标 &  &  &  &  \\
教学重难点 &  &  &  &  \\
教材 & {教材:} &  &  &  \\
参考资料 & {参考资料:} &  &  &  \\
% 教材 & {教材:\lipsum[2][1-6]} &  &  &  \\
% 参考资料 & {参考资料:\lipsum[2][1-6]} &  &  &  \\
其他要求 &  &  &  &  \\
\end{tblr}

\bigskip

Notes: \lipsum[2][1-5]

\end{document}

image.png

然而如果改用:

教材 & {教材:\lipsum[2][1-6]} &  &  &  \\
参考资料 & {参考资料:\lipsum[2][1-6]} &  &  &  \\

将导致:

image.png

我不希望放弃:

X[1.25,c,m]
X[1.75,c,m]
X[1,c,m]
X[1.5,c,m]
X[1.75,c,m]

带来的宽度控制上的便利,在这种情况下,有没有好的方案呢?

]]>
https://ask.latexstudio.net/ask/question/18013.html Sat, 14 Mar 2026 13:26:46 +0800
如何画精美的户型图? image.png

\documentclass{article}
\usepackage{tikz}
% 加载常用库:箭头、几何、标注
\usetikzlibrary{arrows.meta, shapes.geometric, decorations.pathreplacing, calc}

% 定义样式:简化重复代码
\tikzset{
    % 墙体样式:粗黑线
    wall/.style={line width=2pt, black},
    % 门窗样式:细黑线
    door/.style={line width=1pt, black},
    window/.style={line width=1pt, black, dashed}, % 窗户用虚线
    % 家具样式:浅灰色填充
    furniture/.style={line width=1pt, black, fill=gray!10},
    % 尺寸标注样式
    dim/.style={line width=0.5pt, black, <->, font=\small}
}

\begin{document}
\begin{tikzpicture}[x=0.5cm, y=0.5cm] % 缩放比例,方便调整大小

% ========== 1. 绘制墙体(外框+内部分隔) ==========
% 户型外框:矩形 (0,0) 到 (20,15)
\draw[wall] (0,0) rectangle (20,15);
% 客厅-卧室分隔墙:竖线 (8,0) 到 (8,15)
\draw[wall] (8,0) -- (8,15);
% 卧室1-卧室2分隔墙:横线 (8,8) 到 (20,8)
\draw[wall] (8,8) -- (20,8);
% 卫生间分隔墙:(15,8) 到 (15,15)
\draw[wall] (15,8) -- (15,15);

% ========== 2. 绘制门窗 ==========
% 入户门:(0,5) 到 (1,5)(门宽1单位)
\draw[door] (0,5) -- (1,5);
\draw[door] (1,5) arc (0:90:1); % 门的开启弧度(90度)
% 客厅窗户:(4,15) 到 (7,15)(虚线)
\draw[window] (4,15) -- (7,15);
% 卧室1窗户:(8,12) 到 (12,12)
\draw[window] (8,12) -- (12,12);
% 卫生间门:(15,10) 到 (16,10)
\draw[door] (15,10) -- (16,10);
\draw[door] (16,10) arc (0:-90:1);

% ========== 3. 绘制家具(简化示意) ==========
% 卧室1的床:矩形 (9,9) 到 (13,11)
\draw[furniture] (9,9) rectangle (13,11) node[midway] {床};
% 客厅的沙发:矩形 (2,2) 到 (6,4)
\draw[furniture] (2,2) rectangle (6,4) node[midway] {沙发};
% 卫生间的马桶:圆形 (16,9),半径0.5
\draw[furniture] (16,9) circle (0.5) node[below] {马桶};

% ========== 4. 尺寸标注 ==========
% 户型总宽度:下方标注 (0,-1) 到 (20,-1)
\draw[dim] (0,-1) -- (20,-1) node[midway, below] {20m};
% 户型总高度:右侧标注 (21,0) 到 (21,15)
\draw[dim] (21,0) -- (21,15) node[midway, right] {15m};
% 卧室1宽度:(8,-2) 到 (15,-2)
\draw[dim] (8,-2) -- (15,-2) node[midway, below] {7m};

\end{tikzpicture}
\end{document}

试了一下现有的宏包, 都相去甚远, 有没有什么好的宏包推荐一下呢?

]]>
https://ask.latexstudio.net/ask/question/18009.html Tue, 10 Mar 2026 16:35:13 +0800
我说了什么????我在干什么???yyyyy 就不告诉你,就不告诉你,就不告诉你!!!

]]>
https://ask.latexstudio.net/ask/question/18008.html Wed, 04 Mar 2026 09:02:02 +0800
VSCode编译问题 压缩包是完整的,没有修改过的,其他人可以正常使用。

我在vscode终端输入:

pdflatex 地区科学基金项目-正文-2026.tex

或输入

xelatex 地区科学基金项目-正文-2026.tex

均编译失败。

代码链接:https://github.com/fylimas/nsfc

注释:我编译的是地区基金

]]>
https://ask.latexstudio.net/ask/question/18007.html Mon, 02 Mar 2026 10:30:07 +0800
TikZ的计算宏包算直线与圆交点坐标不精确? 在用TIKZ内intersections,calc宏包计算与X轴成150度、225度特殊角直线与圆的交点后,输出显示这些点的直角坐标、极坐标值时,发现有数值上的误差,用三角函数公式计算验证时就不是这些数值,这现象是如何引起的呢?

image.png

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{intersections, calc}
\begin{document}
\def\pttocm#1{\pgfmathparse{#1/28.45274}\pgfmathresult}
\makeatletter
\def\b{8}   
\def\a{tan(225)}    
\def\c{tan(150)}        
\begin{tikzpicture}
\draw[->](-10,0) -- (10,0) node[right] {$x$};
\draw[->](0,-10) -- (0,10) node[left] {$y$};
\draw[name path global=m,black,line width=0.5pt,domain=0*pi:2*pi,samples=360] plot({\b*sin(\x r)},{\b*cos(\x r)});
\draw[name path global=n,black,line width=0.5pt,domain=0:-8,samples=10] plot(\x,{\a*\x});   
\draw [name intersections={of=n and m, by=u}][teal,fill=orange](u) circle(5pt);     
\draw[name path global=k,black,line width=0.5pt,domain=0:-8,samples=5] plot(\x,{\c*\x});    
\draw [name intersections={of=k and m, by=s}][teal,fill=orange](s) circle(5pt);     
\pgfpointanchor{u}{center}
\pgfgetlastxy{\ux}{\uy}
\pgfpointanchor{s}{center}
\pgfgetlastxy{\sx}{\sy}
\fill[purple,font=\Large] let \p1=(u) in (\p1) circle (2pt) node  at(-3,-5) {$[x=\pttocm{\the\pgf@x}]$};
\fill[purple,font=\Large] let \p1=(u) in (\p1) circle (2pt) node  at(-3,-5.75) {$[y=\pttocm{\the\pgf@y}]$};
\fill[purple,font=\Large] let \p1=(s) in (\p1) circle (2pt) node  at(-3,5.75) {$[x=\pttocm{\the\pgf@x}]$};
\fill[purple,font=\Large] let \p1=(s) in (\p1) circle (2pt) node  at(-3,5) {$[y=\pttocm{\the\pgf@y}]$};
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\coordinate (A) at (0,0);
\coordinate (B) at (\ux,\uy);
\coordinate (C) at (\sx,\sy);
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{B}{center}}
\edef\angle{\pgfmathresult}
\node at (-5.5,-6.75) [blue,font=\Large] {$[\rho=\b]$};
\node at (-4.5,-7.5) [blue,font=\Large] {$[\theta=\angle^\circ]$};
\pgfmathanglebetweenpoints{\pgfpointanchor{A}{center}}{\pgfpointanchor{C}{center}}
\edef\angle{\pgfmathresult}
\node at (-1.5,4.25) [blue,font=\Large] {$[\rho=\b]$};
\node at (-0.5,3.5) [blue,font=\Large] {$[\theta=\angle^\circ]$};
\end{tikzpicture}
\end{document}      

abc.jpg document_test2.tex

]]>
https://ask.latexstudio.net/ask/question/18006.html Sun, 01 Mar 2026 15:35:17 +0800
「持续更新」是否有好用的TikZ可视化绘图工具? 姊妹链接。如题。

但我要补充的一点是:

方便了是方便了,那么代价是什么呢?

  • 代码可读性变差
  • 代码可维护性变差
  • 很可能你并不能学会tikz(鱼 v.s. 渔)
  • 细节并不能处理得完美
  • 工作流中断 ...
]]>
https://ask.latexstudio.net/ask/question/18005.html Fri, 27 Feb 2026 19:32:51 +0800
网站下载功能坏了吗,点击下载无反映? image.png

]]>
https://ask.latexstudio.net/ask/question/18004.html Thu, 26 Feb 2026 15:00:36 +0800
表格文字颜色统一设置 学术论文里某个表格非常复杂(单元格特别多),怎样设置能够不用对每个单元格文字内容加\textcolor,以实现将这个表格所有的文字或数据变成红色字体?

]]>
https://ask.latexstudio.net/ask/question/18002.html Mon, 09 Feb 2026 17:09:50 +0800
使用forest宏包排版树状结构图对于多行文本如何保持节点的对齐? 如题,对于如下的MWE:

\documentclass{standalone}
\usepackage{ctex}
\usepackage[edges]{forest}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{forest}
    for tree={
        grow'=east,
        anchor=west,
        inner sep=0pt,
        outer sep=0pt,
        fit=band,
        align=left,
        if n=1{edge path'={(!ul.south west)-- (!u1.north west)}}{no edge},
        edge={decorate, decoration={brace,amplitude=1.5mm,raise=2mm}}
    }
    [1 一级标题
        [1.1 二级标题
            [1.1.1 三级标题
                [1.1.1.1 四级标题]
                [1.1.1.2 四级标题]
            ]
            [1.1.2 三级标题
                [1.1.2.1 四级标题]
                [1.1.2.2 四级标题]
            ]
        ]
        [1.2 二级标题
            [1.2.1 三级标题
                [1.2.1.1 四级标题]
                [1.2.1.2 四级标题]
            ]
            [1.2.2 三级标题
                [1.2.2.1 四级标题]
                [\parbox{8em}{文字文字文字文字文字文字文字文字文字文字文字文字}]
            ]
        ]
    ]
\end{forest}
\end{document}

image.png

希望「{」的父节点总是位于其所有子节点的几何中心。

]]>
https://ask.latexstudio.net/ask/question/18001.html Sun, 08 Feb 2026 11:15:21 +0800
l3build 如何打包宏包? 请问,下面的常规编译命令改用 l3build 的方式要怎么操作最方便啊?

我的目的是得到一本完整的 PDF 手册。

附上 hello.inshello.dtx 的源码。

下面的代码是使用传统的 DocStrip 的方式所用到的编译命令。

latex hello.ins

xelatex hello.dtx
makeindex -s gglo.ist -o hello.gls hello.glo
makeindex -s gind.ist -o hello.ind hello.idx
xelatex hello.dtx
xelatex hello.dtx

不知道为什么命令 l3build unpack 不能释放出 hello.sty 文件,会卡在 \usepackage{xeCJK} 这一行。然后我就问了 AI ,并用了下面的命令来编译:

latex hello.ins
l3build doc

然后因为我看不懂 l3build 文档,所以 build.lua 文件(上传失败)的代码也是 AI 生成的:

module = "hello"
-- 关键:禁止 l3build 尝试管理打包过程
packtds = 0
-- 关键:清空 unpackfiles,表示“不需要解包”
unpackfiles = {}
-- 明确源文件目录
sourcefiledir = "."
sourcefiles = {"hello.dtx", "hello.sty"} -- 将已存在的 .sty 也列为源文件

-- 文档编译设置
docfiledir = "."
docfiles = {module..".dtx"}
typesetfiles = docfiles
typesetexe = "xelatex"
typesetopts = "-interaction=nonstopmode"
typesetindexes = {
  ["hello.glo"] = {"hello.gls", "makeindex -s gglo.ist -o hello.gls hello.glo"},
  ["hello.idx"] = {"hello.ind", "makeindex -s gind.ist -o hello.ind hello.idx"}
}
typesetruns = 3

-- 可选:在清理时保留 .sty 文件
function clean_init()
  -- 不删除 hello.sty
  rm("hello.log", "hello.aux", "hello.glo", "hello.idx", "hello.gls", "hello.ind", "hello.ilg", "hello.out")
end
]]>
https://ask.latexstudio.net/ask/question/17998.html Wed, 28 Jan 2026 23:27:22 +0800
为什么目录超过一页就会产生空白页? 是一个美赛模板,不知道为什么目录一旦超过一页或者差不多满一页再接下来正文时就会有一个莫名其妙的空白页?

image.png

]]>
https://ask.latexstudio.net/ask/question/17996.html Sat, 17 Jan 2026 18:31:52 +0800
`elegantbook`宏包的使用`biblatex`选项backref=true时跳转位置不准确? Claim:这种跳转似乎只在pdflatex编译下可复现,在xelatex下跳转行为神秘...

如题,考虑如下的MWE:

elegantbook.cls可以在这里获取。

\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
  author       = {Aristotle},
  title        = {De Anima},
  date         = 1907,
  editor       = {Hicks, Robert Drew},
  publisher    = cup,
  location     = {Cambridge},
  keywords     = {primary},
  langid       = {english},
  langidopts   = {variant=british},
  annotation   = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{elegantbook}
\title{An Elegant \LaTeX{} Template for Books}
\subtitle{Classic Elegant\LaTeX{} Template}
\author{Ethan Deng, Liam Huang, syvshc, sikouhjw \& Osbert Wang}
\institute{Elegant\LaTeX{} Program}
\date{Dec. 31, 2022}
\version{4.5}
\bioinfo{Bio}{Information}
\extrainfo{\textcolor{red}{\bfseries Caution: This template will no longer be maintained since January 1st, 2023.}}
\logo{example-image-duck.pdf}
\cover{example-image-duck.pdf}
\ExecuteBibliographyOptions{backref=true}% add backref support here
\addbibresource{refs.bib}% bib
\begin{document}

\frontmatter

\maketitle%<-

\mainmatter

\lipsum[1-10]

\section{Bibliography}

This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both \lstinline{numeric}. Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending

In order to get the editors' auto-completion working, you need to add following code in your preamble:

\lipsum

\printbibliography[heading=bibintoc, title=\ebibname]

\end{document}

情况一:

含有\maketitle,文末参考文献的索引将错误地跳转到「封面首页」

情况1.gif

情况二:

如果去掉\maketitle,则行为符合预期

情况2.gif


问题:

  • 这种现象出现的原因是什么?
  • 在不改动「elegantbook.cls」的绝对前提下,修复\ExecuteBibliographyOptions{backref=true}在添加了\maketitle时功能的最佳实践是?

Edited

一点探索,基本文档类book使用\maketitle不会有这个问题:

\begin{filecontents*}[overwrite]{refs.bib}
@book{anima,
  author       = {Aristotle},
  title        = {De Anima},
  date         = 1907,
  editor       = {Hicks, Robert Drew},
  publisher    = cup,
  location     = {Cambridge},
  keywords     = {primary},
  langid       = {english},
  langidopts   = {variant=british},
  annotation   = {A \texttt{book} entry with an \texttt{author} and an \texttt{editor}},
}
\end{filecontents*}
\documentclass[11pt]{book}
\usepackage{lipsum}
\title{test}
\usepackage[backref=true]{biblatex}
\addbibresource{refs.bib}% bib
\usepackage{hyperref}
\begin{document}

\frontmatter

\maketitle%<-

\mainmatter

\lipsum[1-10]

\section{Bibliography}

This template uses biblatex to generate the bibliography, the default citestyle and bibliography style are both Let's take a glance at the citation effect. ~\cite{anima} use data from a major peer-to-peer lending.

\lipsum

\printbibliography

\end{document}

因此问题应该出在elegantbook自定义的封面命令中....

]]>
https://ask.latexstudio.net/ask/question/17995.html Sat, 17 Jan 2026 15:57:15 +0800