Sagittarius Rover
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

注册于 2年前

回答
254
文章
0
关注者
11

可以试试这组参数

xleftmargin=.35em,%
xrightmargin=.35em,%

image.png

image.png

但这是要在geometry宏包不修改左右页面相对距离以及指定文档类的oneside选项的前提下的(如果修改了,这组参数也要做相应修改):

\documentclass[oneside]{ctexbook}
\usepackage{zhlipsum}
\usepackage[showframe]{geometry}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{titlesec}
\titleformat*{\section}{\makebox[\textwidth][c]} 
\titleformat{\section}[frame]
    {\color{magenta}}
    {\centering\footnotesize\enspace 节 \thesection\enspace}
    {8pt}
    {\bfseries\filcenter\songti}
    [\vspace{-10pt}]

\usepackage{listings}
\usepackage{xcolor}

\lstdefinelanguage{VBA}{
    morekeywords={Sub, End, Dim, As, Set, Range, Worksheet, MsgBox, If, Then, Else, For, Next, Do, While, Loop, Integer, String},
    sensitive=true,
    morecomment=[l]{'},
    morestring=[b]{"},
    keywordstyle=\color[HTML]{0184bc},
    stringstyle=\color[HTML]{41a977},
    basicstyle=\small\ttfamily,
    keepspaces=true,
    numbers=left,
    columns=fullflexible,
    xleftmargin=.35em,%
    xrightmargin=.35em,%
}

\lstset{
    language=VBA,
    frame=single,
    linewidth=\dimexpr\textwidth\relax,
    escapeinside=``
}

\begin{document}
\section{初步}
\begin{lstlisting}[caption={生成斐波那契数列},label={code:fib}]
'To generate the Fib Sequence
Sub GenerateFibonacci()
\end{lstlisting}
\end{document}

你的代码这么长(足足有116行),你觉得他是最小工作示例吗?

  • 如果你注释你的代码块的内容,问题仍然存在,这说明代码块内容可以简化为Hello, World!,缩短20行
  • 这说明与lisitngs宏包无关,同时再把你有关\lstset设置全删了,缩短50行
  • 删到最终你会发现,连下面的例子都报错:
\documentclass{ctexbook}
\usepackage{geometry}
\ctexset{
    chapter = {
        name = {\S},   % 将"第X章"改为"§ X"
        number = \arabic{chapter},    % 阿拉伯数字编号
        format = \songti\large\bfseries\centering, % 标题格式
        beforeskip = 2.5ex,          % 标题前间距
        afterskip = 2.5ex,           % 标题后间距

      }
 }

\begin{document}

\chapter{哈哈哈}
\section{初步}
Hello, World!

\end{document}

为什么要不负责任地把大段的代码贴上来增加别人的阅读量

答案你也知道了... 第一个问题是\ctexset内不能有空行...

LaTeX不是python,不能想空行就空行,每一个空格,每一个~甚至注释符号%都有其作用,必须每一步都谨小慎微。

希望下次不要再看到100+行的最大工作示例。

删去空行之后,第二个问题是

\chapter{哈哈哈}
Not allowed in LR mode.

从原来的代码再次删,不难发现,这段代码一加就报错:

\renewcommand{\contentsname}{%
  \begin{center}
    \normalfont\songti\bfseries 文章目录
  \end{center}
}

这又是为什么呢?原因就是Not allowed in LR mode.....

附第二份MWE:

\documentclass{ctexbook}
\usepackage{zhlipsum}
\usepackage{titletoc}
\usepackage{titlesec}
\usepackage{geometry}
\usepackage{fontspec}
\geometry{a4paper,centering,scale=0.9}
\renewcommand{\contentsname}{%
  \begin{center}
    \normalfont\songti\bfseries 文章目录
  \end{center}
}

\begin{document}

\tableofcontents

\chapter{哈哈哈}

\section{初步}

\end{document}

理论上提取MWE的操作不需要任何LaTeX技能,甚至来个小学生不断二分编译都能提取出来....只是因为大家的代码太长....都懒....

这些都是哪里学的....请使用@u79794 老师提供的方法....

你显然应该每加一个设置就编译,如果报错找问题,没报错再进行下一个配置。你一开始面临的代码存在多处问题,这些问题互相影响,让你的代码很难debug....

这种形如方程x+y=const的映射必定是线性的,所以找到一个用两重循环的变量\x以及\y正好可以覆盖所需位置的线性坐标映射即可:

\documentclass[border=2pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
    \foreach \x in {1,2}
        \foreach \y in {1,...,6}
            \node at (\x-.5,\y-.5) [scale=.75] {$(\x,\y)$};
        \draw (0,0) grid ([xshift=-.01pt]2,6);
        \clip [xshift={2cm-.01pt}] (0,0) -- (45:{3*sqrt(2)}) -- (90:6) -- cycle;
        \draw [xshift=2cm,rotate=45,step={sqrt(2)/2}] (0,0) grid (6,6);
        \foreach \x in {5,...,9}
            \foreach \y in {1,...,\fpeval{(10-\x)}}
                \node at (\x/2,\fpeval{\y+(\x-5)/2}) [scale=.5] {$(\fpeval{\x/2},\fpeval{\y+(\x-5)/2})$};
\end{tikzpicture}
\end{document}

image.png

Edited:

其实也就是小学生找规律问题的\pgffor版本罢了...

General Case:

\documentclass[border=2pt,tikz]{standalone}
\newcommand*{\drawmygrid}[2]{%
    \begin{tikzpicture}
    \foreach \x in {1,...,#1}
        \foreach \y in {1,...,#2}
            \node at (\x-.5,\y-.5) [scale=.75] {$(\x,\y)$};
        \draw (0,0) grid ([xshift=-.01pt]#1,#2);
        \clip [xshift={#1cm-.01pt}] (0,0) -- (45:{(#2/2)*sqrt(2)}) -- (90:#2) -- cycle;
        \draw [xshift={#1cm},rotate=45,step={sqrt(2)/2}] (0,0) grid (#2,#2);
        \def\Na{\fpeval{2*#1+1}}
        \def\Nb{\fpeval{\Na+#2-1}}
        \foreach \x in {\Na,...,\fpeval{\Nb-1}}
            \foreach \y in {1,...,\fpeval{\Nb-\x}}
                \node at (\x/2,\fpeval{\y+(\x-\Na)/2}) [scale=.5] {$(\fpeval{\x/2},\fpeval{\y+(\x-\Na)/2})$};
\end{tikzpicture}
}
\begin{document}
\drawmygrid{2}{6}

\drawmygrid{5}{10}

\drawmygrid{8}{15}
\end{document}

image.png

我似乎觉得这个问题还和字体有关:

这个链接里面的不同字体,破折号的长度并不总是2\ccwd,也并不总不是2\ccwd,此外如果直接用\rule,似乎是可以同时控制高度,长度和粗细的...

也许可以在ctex-kitissues里面搜索,有不少有关的讨论。

\documentclass[fontset=ubuntu]{ctexart}
\begin{document}

我能吞下玻璃而不伤身体.

你好-远方不远.

你好--远方不远.

你好---远方不远.

你好——远方不远.

你好\rule[.6ex]{2\ccwd}{.5pt}远方不远.

我能吞下玻璃而不伤身体.

\end{document}

image.png

xeCJK中也有一些黑魔法,与标点距离有关的还有这个回答

\documentclass[fontset=ubuntu]{ctexart}
\xeCJKsetwidth{——}{1.2\ccwd}
\begin{document}

我能吞下玻璃而不伤身体.

你好——远方不远.

你好\rule[.6ex]{2\ccwd}{.5pt}远方不远.

我能吞下玻璃而不伤身体.

\end{document}

image.png

Claim: 我不太清楚CTeX套装的编译原理,基于cct或者直接显式调用CJK宏包的中文处理方式从目前来看已经过时了。

如果没有中文数学期刊/某些古早模板的投稿/编译需求,请使用新的发行版TeXLive或者MikTeX,并且使用ctex宏包而不是CJK宏包自带的CJK环境,OP提供的这一网上经典的mp图片似乎有些过时:

这里暂时没有直接回答你的问题,但我探索了一个可行的方案(也应该是比较现代的方案),可以使用luamplib包直接导出为.pdf

注意此时文件应该保存为test.tex而不是test.mp

\documentclass[border=5mm]{standalone}
\usepackage{ctex}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);

% 坐标轴绘制
drawarrow origin -- (0,100);  % Y轴(向上)
drawarrow origin -- (100,0);  % X轴(向右)

% 原点强化显示
drawdot origin withpen pencircle scaled 2pt;

% 中文标签系统
label.bot(btex 原点 etex, origin);       % 原点标注
label.lft(btex $y$ etex, (0,100));       % Y轴标签
label.rt (btex $x$ etex, (100,0));       % X轴标签

endfig;
\end{mplibcode}
\end{document}

TeXLive下直接使用lualatex test.tex编译可以得到图片。

image.png

再在其下方插入五号字的类似脚注的字母abc标注以及整体的注释,来对表格中的指定内容完成标注

我不是太明白何为“再在其下方插入五号字的类似脚注的字母abc标注”以及“整体的注释”,能否提供一个预期示意图呢?另外,提供代码应该完整,否则他人需要手动帮你添加\documentclass,\usepackage{booktabs}等,不方便别人调试

另外,建议你把你的需求分点罗列,使用bullet:

  • 需求1
  • 需求2
  • 需求3

Edited:

  • 对于在"第一行右侧增加信息",可以考虑新建一个空行
  • 对于“想要一个表格专属的表注”,一种方法是texdoc tabularray,另一种方法是使用minipage环境,但是这对caption有一点点影响...

如果一定要让『表3-1 xxxxxxx』和『(单位:xx)』处于同一行,一个hoc workaround如下:

\documentclass{ctexart}
\usepackage[paperheight=13cm]{geometry}
\usepackage{booktabs}
\usepackage{capt-of}
\begin{document}
能吞下玻璃而不伤身体能吞下玻璃而不伤身体能吞下玻璃而不伤身体能吞下玻璃而不伤身体我能吞下玻璃而不伤身体\footnote{一个外部脚注}我能吞下玻璃而不伤身体

\noindent\begin{minipage}{\textwidth}
    \centering
    \captionof{table}{表号和表题在表的正上方}\vspace*{-.8\baselineskip}
    \label{tab:exampletable}
    \begin{tabular}{cc}
      & \makebox[.65\linewidth][r]{(单位:mm)}\\
      \toprule
      类型\footnote{你好世界}   & 描述 \\
      \midrule
      挂线表 & 挂线表也称系统表、组织表,用于表现系统\footnote{你好世界} 结构 \\
      无线表 & 无线表一般用于设备配置单\footnote{你好世界} 、技术参数列表等   \\
      卡线表 & 卡线表有完全表,不完全表和三线表\footnote{你好世界} 三种       \\
      \bottomrule
    \end{tabular}
\end{minipage}

能吞下玻璃而不伤身体能吞下玻璃而不伤身体能吞下玻璃而不伤身体能吞下玻璃而不伤身体我能吞下玻璃而不伤身体\footnote{一个外部脚注}我能吞下玻璃而不伤身体

\end{document}

image.png

要想实现三维绘制垂线,需要自己做向量计算:

\documentclass[tikz,border=6pt]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
\begin{document}
\tdplotsetmaincoords{60}{110}
\begin{tikzpicture}[tdplot_main_coords]
  % Axes
  \draw[thick, ->] (0,0,0) -- (4,0,0) node[right] {$x$};
  \draw[thick, ->] (0,0,0) -- (0,3,0) node[right] {$y$};
  \draw[thick, ->] (0,0,0) -- (0,0,2) node[above] {$z$};

  % Points
  \coordinate (A) at (0,1,0);
  \coordinate (B) at (3,2,0);
  \coordinate (C) at (2.5,0,1);

  % Labels
  \path node[above] at (A) {$A$} node[above] at (B) {$B$} node[above] at (C) {$C$};
  \fill[red] (A) circle (1pt) (B) circle (1pt) (C) circle (1pt);

  % Compute projection D
  \pgfmathsetmacro{\ABx}{3 - 0} % Bx - Ax
  \pgfmathsetmacro{\ABy}{2 - 1} % By - Ay
  \pgfmathsetmacro{\ABz}{0 - 0} % Bz - Az
  \pgfmathsetmacro{\ACx}{2.5 - 0} % Cx - Ax
  \pgfmathsetmacro{\ACy}{0 - 1} % Cy - Ay
  \pgfmathsetmacro{\ACz}{1 - 0} % Cz - Az

  % Dot products
  \pgfmathsetmacro{\ABdotAB}{\ABx*\ABx + \ABy*\ABy + \ABz*\ABz}
  \pgfmathsetmacro{\ACdotAB}{\ACx*\ABx + \ACy*\ABy + \ACz*\ABz}

  % Parameter t for projection
  \pgfmathsetmacro{\t}{\ACdotAB / \ABdotAB}

  % Coordinates of D
  \pgfmathsetmacro{\Dx}{0 + \t * \ABx}
  \pgfmathsetmacro{\Dy}{1 + \t * \ABy}
  \pgfmathsetmacro{\Dz}{0 + \t * \ABz}

  % Draw projection
  \coordinate (D) at (\Dx,\Dy,\Dz);
  \fill[blue] (D) circle (1pt) node[right] at (D) {$D$};
  \draw[cyan] (A) -- (B) (C) -- (D);
\end{tikzpicture}
\end{document}

image.png

核心思路是利用向量的投影和加减运算。

另外,下次提问请务必给可以编译测试的例子

要注意markdown行间代码块的用法是三个反引号,否则高亮会不正确。

当你想要知道xyz/.style的含义时,正常的做法是打开终端输入texdoc tikz进行搜索。

事实上你的真正问题是对tikz中的坐标表示不熟悉。

  • (<angle>:<dim>) 表示旋转;(<x-coord>,<y-coord>)表示二维坐标
  • x/y/z={<coordinate>}:

image.png

source2e.pdf中有一个名为\two@digits的宏

69 ⟨∗2ekernel⟩
70 \def\two@digits#1{\ifnum#1<10 0\fi\number#1}

这一问题也被称为前导零(leading-zero)问题,我想如果知道这点还是比较好搜索答案的...

Thanks to MICO

我的思路是模仿自定义\three@digits:

\documentclass[tikz]{standalone}
\usepackage{pgffor}
\usepackage{graphicx}
\begin{document}
\makeatletter
% \def\two@digits#1{\ifnum#1<10 0\fi\number#1}
\def\three@digits#1{\ifnum#1<10 00\else\ifnum#1<100 0\fi\fi\number#1}
\foreach \x in {1,...,120} {\tikz{
    % \node {\includegraphics[width=5cm]{p\x.pdf}};
    \node {\includegraphics[width=5cm]{p\three@digits{\x}.pdf}};
}}
\makeatother
\end{document}

image.png

请注意,这里必须换行,否则代码块无法被正确高亮,我已经帮你改过来了...

image.png

一个问题应该仅集中在一个key-point上。下次提问注意,不要同时问多个不太相关的问题,请分开提问。

关于第一个问题,疑似duplicated as this: https://ask.latexstudio.net/ask/question/8102.html

关于第二个问题,推荐阅读:
https://blog.ljguo.top/2024/06/textcircled-numbers 『需要魔法』
https://mp.weixin.qq.com/s/Zk6GvAYIHVKc-b5HXavAVg 『不需要魔法』


大致修改了两处:

  • 使用了耿楠老师的circledtext宏包
\renewcommand{\theparagraph}{\circledtext{\arabic{paragraph}}} % ①
  • 借助雾月老师的妙招
%%%%%%%%%%% https://ask.latexstudio.net/ask/question/8102.html
\makeatletter%%
\renewcommand{\cftchapfillnum}[1]{%
  {\cftchapleader}\nobreak
  \makebox{\cftchappagefont #1}\cftchapafterpnum\par
}
\renewcommand{\cftsecfillnum}[1]{%
  {\cftsecleader}\nobreak
  \makebox{\cftsecpagefont #1}\cftsecafterpnum\par
}
\renewcommand{\cftsubsecfillnum}[1]{%
  {\cftsubsecleader}\nobreak
  \makebox{\cftsubsecpagefont #1}\cftsubsecafterpnum\par
}
\renewcommand{\cftsubsubsecfillnum}[1]{%
  {\cftsubsubsecleader}\nobreak
  \makebox{\cftsubsubsecpagefont #1}\cftsubsubsecafterpnum\par
}
\renewcommand{\cftparafillnum}[1]{%
  {\cftparaleader}\nobreak
  \makebox{\cftparapagefont #1}\cftparaafterpnum\par
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

image.png

下面是完整代码...看上去是一部旷世巨作的模板啊,就是感觉有点ai味...

\documentclass[a4paper,12pt,openany]{book}
\usepackage{ctex}         % 中文支持
% \usepackage{fontspec}     % 字体配置 没必要...
\usepackage[showframe]{geometry}     % 页面几何设置
\usepackage{tocloft}      % 目录自定义
\usepackage{titlesec}     % 章节标题自定义
\usepackage{tikz}         % 绘图功能,用于圆形编号
\usepackage{circledtext}%%%%modify
\geometry{
    a4paper,
    top=2.5cm,        % 上边距
    bottom=2.5cm,     % 下边距
    left=2.5cm,       % 左边距
    right=2.5cm,      % 右边距
    headheight=1.5cm, % 页眉高度
    headsep=16.75pt,  % 页眉与正文间距
    footskip=0.75cm   % 页脚与正文间距
}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}   
% 章节计数器格式设置
\renewcommand{\thechapter}{\chinese{chapter}}          % 一
\renewcommand{\thesection}{\chinese{section}}          % 一
\renewcommand{\thesubsection}{\arabic{subsection}}     % 1
\renewcommand{\thesubsubsection}{\arabic{subsubsection}} % 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%modify \circledtext
\renewcommand{\theparagraph}{\circledtext{\arabic{paragraph}}} % ①
%目录缩进设置
\setlength{\cftchapindent}{0pt}      % 章不缩进
\setlength{\cftsecindent}{2em}       % 节缩进2em
\setlength{\cftsubsecindent}{4.1em}    % 条缩进3em
\setlength{\cftsubsubsecindent}{4em} % 项缩进4em
\setlength{\cftparaindent}{6em}      % paragraph缩进5em
% 目录编号前后符号设置
% 章:一、 标题
\renewcommand{\cftchapaftersnum}{、}   % 顿号+空格
\setlength{\cftchapnumwidth}{2em}     % 一级标题(章)的编号宽度
% 节:(一) 标题
\renewcommand{\cftsecpresnum}{(}                    % 编号前加左括号
\renewcommand{\cftsecaftersnum}{)}    % 右括号+空格
\setlength{\cftsecnumwidth}{2.56em}    % 二级标题(节)的编号宽度
% 条:1. 标题
\renewcommand{\cftsubsecaftersnum}{.}   % 使用可见字符标记间距位置
\setlength{\cftsubsecnumwidth}{1.467em}  % 减小编号宽度
% 项:(1) 标题
\renewcommand{\cftsubsubsecpresnum}{(}        % 编号前加左括号
\renewcommand{\cftsubsubsecaftersnum}{)}      % 右括号+空格
\setlength{\cftsubsubsecnumwidth}{2em}       % 四级标题(项)的编号宽度
% 项:① 标题
\renewcommand{\cftparapresnum}{}            % 编号前无符号
\renewcommand{\cftparaaftersnum}{}          % 编号后加空格
\setlength{\cftparanumwidth}{1em}         % 编号宽度
%=====================================================
% 正文标题样式设置
%=====================================================
% 章:第X章、标题 定义chapter格式  禁用默认换页行为
\titleclass{\chapter}{straight} 
% 自定义标题格式(保留您的原有设置)
\titleformat{\chapter}[block]
    {\normalfont\zihao{2}\heiti\raggedright}
    {\hspace{2em}\thechapter、}
    {0em}
    {}
% 精确控制间距(标题前=1行距,标题后=0)
\titlespacing*{\chapter}{0pt}{\baselineskip}{0pt} 
% 节:(X)标题
\titleformat{\section}
    {\raggedright\heiti\zihao{3}}        % 格式
    {\hspace{31.5pt}(\thesection)}        % 标签
    {0em}{}                 % 间距和标题
    \titlespacing{\section}
    {0pt}{0pt}{0pt}       % 左间距、上间距、下间距
%  条:X.标题
\titleformat{\subsection}
    {\raggedright\heiti\zihao{4}}        % 格式
    {\hspace{31.5pt}\thesubsection.}       % 标签(全角点)
    {0em}{}                 % 间距和标题
    \titlespacing{\subsection}
    {0pt}{0pt}{0pt}       % 左间距、上间距、下间距
% 项:(X)标题
\titleformat{\subsubsection}
    {\raggedright\heiti\zihao{-4}}       % 格式
    {\hspace{31.5pt}(\thesubsubsection)}  % 标签
    {0em}{}                 % 间距和标题
    \titlespacing{\subsubsection}
    {0pt}{0pt}{0pt}       % 左间距、上间距、下间距
%段:① 标题
\titleformat{\paragraph}
    {\raggedright\heiti\zihao{-4}}       % 格式
    {\hspace{31.5pt}\theparagraph}          % 标签
    {0pt}{}                  % 间距和标题
    \titlespacing{\paragraph}
    {0pt}{0pt}{0pt}        % 左间距、上间距、下间距
%=====================================================
% 目录格式设置
%=====================================================
% 目录标题格式
\renewcommand{\contentsname}{\heiti\zihao{3}\centerline{目\quad 录}}
% 引导线设置
\renewcommand{\cftdot}{.}                % 引导点符号
\renewcommand{\cftdotsep}{0.5}           % 引导点密度(值越小越密集)
\renewcommand{\cftchapdotsep}{\cftdotsep} % 章引导点密度继承全局设置
% 各层级引导线样式
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}   % 章
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}}        % 节
\renewcommand{\cftsubsecleader}{\cftdotfill{\cftdotsep}}     % 条
\renewcommand{\cftsubsubsecleader}{\cftdotfill{\cftdotsep}}  % 项
% 使用 tocloft 的内部命令设置页码前的间距为零
\makeatletter
\renewcommand{\@pnumwidth}{1em}        % 页码宽度
\renewcommand{\@tocrmarg}{1em}         % 设置为与页码宽度相同,消除间距
\makeatother
% 目录间距控制
\setlength{\cftbeforetoctitleskip}{0pt}  % 目录标题与页面顶部间距
\setlength{\cftaftertoctitleskip}{0pt}   % 目录标题与内容间距
\setlength{\cftbeforechapskip}{0pt}      % 章标题间间距
\setlength{\cftbeforesecskip}{0pt}       % 节标题间间距
\setlength{\cftbeforesubsecskip}{0pt}    % 条标题间间距
\setlength{\cftbeforesubsubsecskip}{0pt} % 项标题间间距
%  目录文字样式
\renewcommand{\cftchapfont}{\songti\fontsize{12pt}{14pt}\selectfont} % 章标题字体
\renewcommand{\cftchappagefont}{\songti\zihao{-4}}  % 章页码字体
\renewcommand{\cftsecfont}{\songti\zihao{-4}}       % 节标题字体
\renewcommand{\cftsecpagefont}{\songti\zihao{-4}}   % 节页码字体
\renewcommand{\cftsubsecfont}{\songti\zihao{-4}}    % 条标题字体
\renewcommand{\cftsubsecpagefont}{\songti\zihao{-4}}% 条页码字体
\renewcommand{\cftsubsubsecfont}{\songti\zihao{-4}} % 项标题字体
\renewcommand{\cftsubsubsecpagefont}{\songti\zihao{-4}}% 项页码字体
%%%%%%%%%%% https://ask.latexstudio.net/ask/question/8102.html
\makeatletter%%
\renewcommand{\cftchapfillnum}[1]{%
  {\cftchapleader}\nobreak
  \makebox{\cftchappagefont #1}\cftchapafterpnum\par
}
\renewcommand{\cftsecfillnum}[1]{%
  {\cftsecleader}\nobreak
  \makebox{\cftsecpagefont #1}\cftsecafterpnum\par
}
\renewcommand{\cftsubsecfillnum}[1]{%
  {\cftsubsecleader}\nobreak
  \makebox{\cftsubsecpagefont #1}\cftsubsecafterpnum\par
}
\renewcommand{\cftsubsubsecfillnum}[1]{%
  {\cftsubsubsecleader}\nobreak
  \makebox{\cftsubsubsecpagefont #1}\cftsubsubsecafterpnum\par
}
\renewcommand{\cftparafillnum}[1]{%
  {\cftparaleader}\nobreak
  \makebox{\cftparapagefont #1}\cftparaafterpnum\par
}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{zhlipsum}
\begin{document}
    \tableofcontents
    \newpage
    \chapter*※※※※※※※※{※※※※※※※※1}
    \addcontentsline{toc}{chapter}{※※※※※※※※1} % 手动添加到目录
    \chapter{※※※※※※※※}
    \section{※※※※※※※※}
    \zhlipsum[1-50]
    \subsection{※※※※※※※※}
    \zhlipsum[1-50]
    \subsubsection{※※※※※※※※}
    \zhlipsum[1-50]
    \zhlipsum[1-50]
    \paragraph{※※※※※※※※}
    \zhlipsum[1-50]
    \zhlipsum[1-50]
    \paragraph{※※※※※※※※}
    \zhlipsum[1-50]
    \chapter{※※※※※※※※}
\end{document}

如果仅仅从解决问题的角度,似乎可以在第二个\footnotetext之前做两次\stepcounter{footnote}

\addtocounter{footnote}{-3}
\footnotetext{something}
\stepcounter{footnote}\stepcounter{footnote}
\footnotetext{something else}
\stepcounter{footnote}
\footnotetext{something else}
\stepcounter{footnote}
\footnotetext{something else}

image.png

但这显然不是本post的主要目的,还是更希望知道如何避免偶然被footmisc的这一行为坑到...

代码过长了,要体现你的脚注问题并不需要这么多代码

请修改你的代码,同时最好附上不满意的效果截图。


Edited:

本问题一个可能的解决办法请看: https://tex.stackexchange.com/a/21817/322482

\renewcommand{\thefootnote}{\ding{\numexpr181+\value{footnote}}}

image.png

如果不使用\usepackage[perpage]{footmisc} %每页脚注重新编号

则问题基本可以从上面的链接得到解决...

\documentclass[11pt,landscape,a4paper]{ctexart}
\usepackage{amsmath,amssymb,amsthm}     %数学必备宏包
\usepackage{geometry}          %  设置页面属性
% \usepackage[perpage]{footmisc}  %每页脚注重新编号
\usepackage{pifont}
\renewcommand{\thefootnote}{\ding{\numexpr181+\value{footnote}}}
\geometry{left=3cm,right=2cm,top=2cm,bottom=5cm}
\begin{document}
$\text{\parbox{1em}{基本立体图形}}\begin{cases}\text{多面体\footnotemark}\begin{cases}\text{棱柱\footnotemark}\begin{cases}\text{按底面多边形的边数:如三棱柱、四棱柱,……。}\\
\text{按侧棱与底面的关系}\begin{cases}\text{直棱柱}\\
\text{斜棱柱}
\end{cases}\\
\end{cases}\\
\text{棱锥}\\
\text{棱台}\\
\text{组合体}
\end{cases}
\\
\text{旋转体\footnotemark}
\begin{cases}\text{圆柱}\\
\text{圆锥}\\
\text{圆台}\\
\text{组合体}
\end{cases}
\end{cases}$

\addtocounter{footnote}{-2}%%%这里应该-(n-1)...不够自动和优雅的方法...
\footnotetext{由若干个平面多边形}
\stepcounter{footnote}
\footnotetext{有两个面互相平行}
\stepcounter{footnote}
\footnotetext{一条平面曲线绕它所在平面内}

\end{document}

image.png

如果一定要\usepackage[perpage]{footmisc}...

暂弃之(我会更推荐开一个新的问题:『https://ask.latexstudio.net/ask/question/17728.html』,避免本链接涉及的冲突内容过于复杂......)

看模板+微调了一个多小时(还有瑕疵,但我不想改了....)....

image.png

Claim:我在这里不会给出具体的修改方式只提供修改思路。因为实际上还有一些bug,和原始的nxuthesis的相容性也远远不够,还是会有一定的拼接感

  • 下面的所有修改基于CTAN上的nxuthesis,能从官方途径下载就不应该从“附件”这种非官方途径下载
  • 我还是觉得这种发一大段模板上来的做法是十分不被推荐的,而且你还的“附件”还是自己魔改过的,已经是私有模板,没有人会愿意看几千行代码设置(这也是为什么没人回答的原因之一)
  • 再次重申,如果对模板有修改需求,最好的办法一定是提issues,或者想办法提取MWE,直接问“怎么给宁夏大学毕业论文模板添加英文封面?”十分像“伸手党”,这是大多数人讨厌的
  • 基于以上的原因,我的这一回答只是为了自己阅读并学习修改模板的写作思路,并不直接回答这一问题

大致思路——逆向追溯+模仿中文封面的命令定义

明确目标:"给宁夏大学毕业论文模板添加英文封面"

step1: 在文中找到什么命令排版了中文封面:

% nxuthesis.cls Line2177~2186
\renewcommand\maketitle{%
  \cleardoublepage
  \pagenumbering{Alph}%
  \nxu@pdfbookmark{-1}{\nxu@title}%
  \nxu@titlepage
  \ifnxu@include@spine@true
    \spine
  \fi
  \clearpage
}

仔细阅读上面的代码,实际上核心的排版命令为:

  • \nxu@titlepage
  • \spine

我们预期排版中英文版本,那么应该仿照上述的两个命令自定义\nxu@titlepage@en以及\spine@en,同时处理好一些细节

step2:以前者为例,逆向追溯\nxu@titlepage的定义:

% nxuthesis.cls Line2192-2226
\newcommand\nxu@titlepage@thesis{%
  \thispagestyle{empty}%
  % \null\vskip 8.1pt%
  \begingroup
    \centering
    \begingroup
      \fontsize{10.5bp}{10.5bp}\selectfont
      \nxu@titlepage@topinfo\par
    \endgroup
    \vskip 1.7cm%
    \nxu@titlepage@name
    \vskip 0.68cm
    \nxu@title@page@degree@category\par
    \vskip 0.6cm
    \begingroup
      \sffamily\fontsize{22bp}{30bp}\selectfont
      \nxu@title\par
    \endgroup
    \vskip 8pt
    \begingroup
      \fontsize{16bp}{24bp}\selectfont
      \nxu@title@en\par
    \endgroup
    \vskip 24.1pt%
    \vfill
    \begingroup
      \fontsize{14bp}{21bp}\songti
      \nxu@titlepage@info\par
    \endgroup
    \vskip 62pt%
    \fi
  \endgroup
  \clearpage
  \restoregeometry
}

同样仔细观察,上面的封面排版基本可以分为以下五个部分:

  • \nxu@titlepage@topinfo
  • \nxu@title@page@degree@category
  • \nxu@title
  • \nxu@title@en 这部分是我们可以偷过来用的...同时学习kvoptions是如何定义和使用键值对的
  • \nxu@titlepage@info

那么实际上我们进一步的思路是,再次追溯上面的五个命令,并且结合LaTeX排版表格,盒子的方式进行微调,定义对应的\nxu@titlexxxx@yyyy@en,同时注意观察\nxu@titlexxxx@yyyy命令是如何获取nxusetup.tex内的信息的...

step3: 以\nxu@titlepage@topinfo为例,我们预期模仿其定义对应的\nxu@titlepage@topinfo@en命令:

% nxuthesis.cls Line2241-2249
\newcommand\nxu@titlepage@topinfo{
    \nxu@titlepage@topinfo@tabular{3em}{4em}{1em}{
      \nxu@topinfo@iteml{分类号}{\nxu@clc}
      \nxu@topinfo@iteml{密级}{\nxu@secret@level}
    }{
      \nxu@topinfo@itemr{单位代码}{\nxu@code}
      \nxu@topinfo@itemr{学号}{\nxu@student@id}
    }\par
}

仔细观察,这里的\nxu@titlepage@topinfo@tabular用于排版topinfo的表格,其中的前四个参数含义要进一步追溯参照其定义,同时"分类号","密级"以及其对应的\nxu@clc\nxu@secret@level都应该同时做修改。总而言之,上面的所有命令修改和重定义最终都会回到关于nxuthesis基于kvoptionskvsetkeys设置的一系列信息键值对的修改上。我们终于要step into到键值对的设置上...

step4:考虑前面\nxu@title@en埋下的伏笔,我们不难追溯到:

nxusetup.tex Line24-25
title* = {An Introduction to \LaTeX{} Thesis Template of Ningxia
            University v\version},

这里用了title*来存储title@en的信息,同时在nxuthesis.cls中也可以追溯到:

% nxuthesis.cls Line1987-2000
\nxu@define@key{
  secret-level = {
    name = secret@level,
  },
  secret-year = {
    name = secret@year,
  },
  title = {
    default = {标题},
  },
  title* = {
    default = {Title},
    name    = title@en,
  },
.... somthing else
}

可以发现只要在\nxu@define@key内使用title*作为键以及使用name= title@en便可以显式存贮名为\nxu@title@en=Title的宏,据此,修改实现的思路已经基本打通了。

以上。剩下的,就应该是OP自己的努力了~

我猜你也许需要\vfill?

例如我要添加一个答题区域,加边框,自动延伸到页面底部。

请『补充提问』,提供你的『答题区域,加边框』但位于页面顶部的代码以方便测试文字总是不如代码来得直接


Edited:

一个workaround,使用tcbheight fill选项:

\documentclass{ctexart}
\usepackage[showframe]{geometry}
\usepackage[many]{tcolorbox}
\newcommand*{\myenptyboxfill}{%
\begin{tcolorbox}[height fill,sharp corners=all,colback=white]
\end{tcolorbox}
}
\usepackage{zhlipsum}
\begin{document}
\zhlipsum[2]
\myenptyboxfill

\myenptyboxfill

\zhlipsum[name=zhufu]
\end{document}

image.png

应该有更latex2e的方法....

发布
问题