避免题文不符。
\usepackage{ctex}
是调用宏包提供中文支持\documentclass{ctexart}
是声明文档类,其内部调用了ctex
宏包
上面两者是不一样的。
从这个截图来看,你应该没有指定这个编辑器的编译引擎
ctex
宏包或者ctexart
文档类均需要xelatex
或者lualatex
引擎支持。更具体的可见lshort-zh-cn第二章。
\usepackage{ctex}
是调用宏包提供中文支持\documentclass{ctexart}
是声明文档类,其内部调用了ctex
宏包
上面两者是不一样的。
从这个截图来看,你应该没有指定这个编辑器的编译引擎
ctex
宏包或者ctexart
文档类均需要xelatex
或者lualatex
引擎支持。更具体的可见lshort-zh-cn第二章。
考古...
参考自QQ群里Eureka老师给的回答,请看下面的对比。
当然,OP原问题给的代码过长了,提问应该尽量保证代码“最简短”,避免增加阅读障碍。
输出latex3
变量和计数器问题显然应该另开两个问题,这样很容易让后来的读者感到混乱迷惑,削弱论坛的信息共享作用。
可以比较下面的例子:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{counter}
\newcounter{cntA}
\newcounter{cntB}
\NewExpandableDocumentCommand{\cmdA}{}
{%
\thecntA%
\addtocounter{cntA}{1}
}
\NewExpandableDocumentCommand{\cmda}{}
{%
okA&\cmdA\\
}
\newcommand{\cmdB}{%
\thecntB%
\addtocounter{cntB}{1}
}
\newcommand*{\cmdb}{%
okB&\cmdB\\
}
\setlength{\parindent}{0pt}
\begin{document}
\begin{tblr}[expand=\expanded]{colspec={|X|X|}}
\expanded{\cmda}
\expanded{\cmda}
\expanded{\cmda}
\end{tblr}
\bigskip
\begin{tblr}[expand=\cmdb]{colspec={|X|X|}}
\cmdb
\cmdb
\cmdb
\end{tblr}
\end{document}
在tblr
以及longtblr
环境中,有两种展开方式:
expand=<expandable token>
,将直接展开一次expand=\expanded
后在tblr
内部使用\expanded{<expandable token>}
进行完全(exhaustive)展开(e-type
展开)而虽然\newcommand
与\NewExpandableDocumentCommand
定义的命令均可展开,但:
\newcommand
允许只执行部分展开\NewExpandableDocumentCommand
要求只能被完全展开而同时\addtocounter
实际上是TeX
原语\advance
将\value{cnt}
的+1
:
\addtocounter:
macro:#1#2->\@ifundefined {c@#1}{\@nocounterr {#1}}{\global \advance \csname c@#1\endcsname #2\relax }
这是一种assignment过程,属于不可展开的命令,他们因此不应该被放在\NewExpandableDocumentCommand
内部。若如此做,将导致该命令变为不可展开类型。
因此在OP的原问题中,tblr
环境将会先搜集其内部的所有命令,然后再执行展开\NewExpandableDocumentCommand
定义的\cmd
(但此时不可展开)。此时使用\expanded{\cmd}
将导致直接进行e-type
展开将\thecnt
完全展开为初始值0
.
因此洞察到\addtocounter
不可展开,同时在这一情形下仅需要单步展开,决定了应该使用\newcommand
以及\expand=\cmd
实现.
@u38442 林间花(xxn)老师指出:
你好像传入了这个\makebox[5\ccwd][s]{第\chinese{chapter}回}
就变成了[5][s]第一回....
书签使用\texorpdfstring{⟨TEX 字符串⟩}{⟨PDF 字符串⟩}
哈
同时严厉地指责了我不看hyperref
文档的恶劣行为:
尝试传入chapter/number={\texorpdfstring{...}{...}}
即可:
\documentclass[b5paper,twoside,openany]{ctexbook}
\usepackage{zhlipsum}
\ctexset{
chapter/name = {,},
chapter/number = {\texorpdfstring{\makebox[5\ccwd][s]{第\chinese{chapter}回}}{第\chinese{chapter}回}},
}
\usepackage[%
bookmarksnumbered=true,
]{hyperref}
\begin{document}
\tableofcontents
\chapter{这是一个标题名1}\zhlipsum[1-6]
\addtocounter{chapter}{9}
\chapter{这是一个标题名2}\zhlipsum[1-6]
\end{document}
测试上一问题评论源代码:
总是尝试先 最小化代码----定位问题----优先看文档/寻找论坛旧文----解决问题...
非常感谢林间花老师~
考古...
\framebox
是水平模式的盒子,其对齐的基线为bottom
可以使用adjustbox
...这里有另一个类似的链接
\documentclass{article}
\usepackage{tabularray}
\usepackage{graphicx}
\usepackage{adjustbox}
\begin{document}
\begin{tblr}{
colspec={X[12em,c]X[10em,c]},
rowspec={|Q[m]|Q[m]|},
stretch=0}
AAA & BBB\\
\adjustimage{padding=\fboxsep,frame,width=\linewidth,valign=c}{example-image-duck}
& $\{x \mid 0<x<4\}$\\
\end{tblr}
\end{document}
感谢@u64726 提供的思路,微调了一下...
\documentclass[b5paper,twoside,openany,UTF8]{ctexbook}
\usepackage{zhlipsum}
\usepackage{zhnumber}
\ctexset{
chapter/name = {,},
chapter/number = {\makebox[5\ccwd][s]{第\chinese{chapter}回}},
}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\fancyhead[CO]{\zihao{5}\rightmark}
\fancyhead[CE]{\zihao{5}\leftmark}
\fancyfoot[RO]{--~\thepage~--}
\fancyfoot[LE]{--~\thepage~--}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\chaptermark}[1]{%
\markboth{\makebox[5\ccwd][s]{第\zhnumber{\thechapter}回}}{#1}
}
% 章节首页样式(无页眉和页眉横线,仅保留页码)
% 这是由于在book.cls中,章节首页预定义了样式 \thispagestyle{plain}
% 因此此处重定义 plain 样式相当于重定义了 章节首页
\fancypagestyle{plain}{%
\fancyhf{}
\fancyfoot[RO]{--~\thepage~--}
\fancyfoot[LE]{--~\thepage~--}
\renewcommand{\headrulewidth}{0pt}
}
\begin{document}
\tableofcontents
\chapter{这是一个标题名1}\zhlipsum[1-6]
\addtocounter{chapter}{9}
\chapter{这是一个标题名2}\zhlipsum[1-6]
\addtocounter{chapter}{9}
\chapter{这是一个标题名3}\zhlipsum[1-6]
\end{document}
(有没有什么方便的同时展现10+个pdf页面的截图方式啊...上图至少微调了2分钟大小...)
maybe related(不太确定)...
related link
\documentclass[12pt]{ctexart}
\usepackage{amsmath}
\usepackage{empheq}
\usepackage{bm}
\begin{document}
\begin{equation}
a^2+b^2=c^2
\end{equation}
\begin{empheq}[left={a=\empheqlbrace}]{align}
\dot{\bm{\lambda}} (t) &= -\frac{\partial H}{\partial \bm{x}}, \label{AA} \\
\frac{\partial H}{\partial \bm{u}} &= 0, \label{BB} \\
\dot{\bm{x}} &= \bm{f} (t,\bm{x}, \bm{u}), \notag
\end{empheq}
\begin{equation}
a^2+b^2=c^2
\end{equation}
\end{document}
@u64726 Try This and consult for the .log
file, by Eureka
\documentclass{article}
\listfiles
\begin{document}
test
\end{document}
TeXLive2024
+XeLaTeX
一切正常,建议进一步检查宏包版本
可以在导言区使用\listfiles
之后在.log
文件中找到各个版本。
请提供你进行尝试的代码,并说明具体是哪点的实现遇到了困难。
可以参考这个链接。
有的,考虑line cap=round
和line join=round
命令(可以texdoc tikz
搜索)。
终于找到有人和我一样放大5000%倍pdf欣赏自己的TiKZpicture的了(握手)
\documentclass[tikz,border=10pt]{standalone}
\begin{document}
\begin{tikzpicture}[scale=.5,line cap=round,line join=round]
\draw[domain=0:8, smooth, variable=\x] plot ({\x}, {1/16*pow(\x, 2)});
\draw[domain=0:8, smooth, variable=\x] plot ({\x}, {-1/16*pow(\x, 2)});
\draw (8,0) ellipse (.4cm and 4cm);
\end{tikzpicture}%但我感觉还是差点意思
%如果不是完全追求 精确的函数关系的话
%可以试试控制点(?)
\begin{tikzpicture}[scale=.5,line cap=round,line join=round]
\draw (0,0) .. controls (4,-.3) and (6,-2.3) .. (7.958,-3.98);
\draw (0,0) .. controls (4,.3) and (6,2.3) .. (7.958,3.98);
\draw (8,0) ellipse (.4 and 4);
\end{tikzpicture}
%不过代码似乎也不够优雅...
\end{document}
如果是精确的两条直线分别连接了同一个点的话,前面的round
命令可以自动让这一切保持圆滑,但题主的问题中幂函数和椭圆方程在数学上似乎本身就是相交的,这也许是导致出现需要微调的原因(?)
图床/或者说文件床最近挂了...你的mwe我打不开....
尝试了一下:
\documentclass{ctexart}
\usepackage{xcolor}
\usepackage[b5paper,landscape,showframe]{geometry}
\usepackage{needspace}
\usepackage{zhlipsum}
\usepackage{circledtext}
\ExplSyntaxOn
\clist_new:N \g_my_parnote_clist
\clist_new:N \g_my_parnotetxt_clist
\makeatletter
\newcounter{parnotecnt}
\NewDocumentCommand{\parnote}{O{red} m m}{%
\refstepcounter{parnotecnt}
\unskip\textcolor{#1}{#2}\hbox{\@textsuperscript{\normalfont\circledtext[charf=\small]{\arabic{parnotecnt}}}}\unskip
\clist_gput_right:Nn \g_my_parnote_clist {#2}
\clist_gput_right:Nn \g_my_parnotetxt_clist {#3}
}
\makeatother
\NewDocumentEnvironment{myenv}{+b}{%
\setcounter{parnotecnt}{0}%
\clist_clear:N \g_my_parnote_clist
\clist_clear:N \g_my_parnotetxt_clist
\needspace{\baselineskip}{\bfseries~【原文】}\par
{#1} \par%\vspace{5pt}
% \clist_use:Nn \g_my_parnote_clist {,}
\clist_if_empty:NF {\g_my_parnote_clist}{%
\needspace{.8\baselineskip}{\bfseries~【注释】}\par
\int_step_inline:nn {\clist_count:N \g_my_parnote_clist}{%
\noindent{##1}.~\clist_item:Nn \g_my_parnote_clist {##1}:~\clist_item:Nn \g_my_parnotetxt_clist {##1}~\par
}
}\vspace{2cm}%
}{}
\ExplSyntaxOff
\begin{document}
\begin{myenv}%
\zhlipsum[2]
测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本
\end{myenv}
\begin{myenv}%
\zhlipsum[2]
测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本测试文本\parnote{红色注释}{注释内容}测试文本\parnote[cyan]{蓝色注释}{注释内容}测试文本
\zhlipsum
\end{myenv}
\begin{myenv}
如果文段中没有\texttt{parnote},则不会输出【注释】\par
\zhlipsum[2]
\end{myenv}
\end{document}
不太确定还有没有什么bug...
只是好奇,如果既不显示序号,也不显示脚注,那么你输入\footnote{这是一个脚注,但不会显示序号和文字。}
是想告诉LaTeX
什么信息呢? 序号+1?
也许提供一些必要的使用场景会更好一点。
也许是这个意思?设置\hidefootnotefalse
正常显示:
\documentclass{ctexbook}
\usepackage[b6paper,landscape]{geometry}
\newif\ifhidefootnote
\hidefootnotefalse
\ifhidefootnote
\renewcommand*{\footnote}[1]{}
\fi
\begin{document}
这是一段示例文字,\footnote{这是一个脚注,但不会显示序号和文字}脚注序号和脚注内容均不显示\footnote{这是一个脚注,但不会显示序号和文字}。
\end{document}
设置\hidefootnotetrue
则隐藏脚注:
\documentclass{ctexbook}
\usepackage[b6paper,landscape]{geometry}
\newif\ifhidefootnote
\hidefootnotetrue
\ifhidefootnote
\renewcommand*{\footnote}[1]{}
\fi
\begin{document}
这是一段示例文字,\footnote{这是一个脚注,但不会显示序号和文字}脚注序号和脚注内容均不显示\footnote{这是一个脚注,但不会显示序号和文字}。
\end{document}
`
包围,以防止吞反引号建议按下面的内容阅读(不完全是线性的关系):
lshort-zh-cn
的5.1节(链接昨天给了,这里不给)zlatex manual
的文档关于字体配置的内容xeCJK
文档的获取字体族名一节fontspec
的官方文档(有点长,但你只要看前几页即可)fntguide
上面没有贴链接的文档都可以在终端输入texdoc <文档名>
获取
总而言之,最简单的实践是:
设置字体有两种找到字体的方法:
windows
安装到系统目录C:\Windows\Fonts
下.ttf/.otf
文件直接访问字体(免安装)西文字体可以通过:\set<main/sans/mono>font
设置
CJK(中日韩)字体可以通过:\setCJK<main/sans/mono>font
设置
数学字体可以使用unicode-math
宏包后指定:\setmathfont
设置
请务必找到TeX
能认识的字体族名/将.ttf/otf
文件放在.tex
同目录下,我不确定manim
的字体体列表获取的是否是字体族名。
markdown
的围栏代码块的样式应为三个反引号`
!!!可以将aligned
替换为gathered
,此外在嵌套环境的外层只需用equation
即可。
由于你的纸似乎有点小,用\zihao{5}
在数学模式下调整字体大小不合理。我下面的MWE修改了纸张大小为a3paper
.
\documentclass[12pt]{ctexart}
\usepackage[a3paper,top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry}
\usepackage{amsmath}
\begin{document}
\begin{equation}
s.t.=\left\{
\begin{gathered}
\varDelta _k^{(p)} = \sum_{i=1}^{54} \sum_{j=1}^{2} c_{ijk}x_{ijk}^{(p)}\\
\varPhi _k^{(p)} = \sum_{j=1}^{2} w_{jk}\min\left\{\sum_{i=1}^{64}u_{ijk}x_{ijk}^{(p)},S_{jk}\right\}\\
\varTheta _k^{(p)} = \lambda \sum_{j=1}^{2} w_{jk}\max\left\{\sum_{i=1}^{54}u_{ijk}x_{ijk}^{(p)} - S_{jk}, 0\right\}\\
x_{i2k}^{(p)}=0 \quad k=1,2,\cdots,16\\
x_{ijk}^{(p)}x_{i2k}^{(p)} = 0 \quad k\in R\\
x_{i2k}^{(p)} x_{i1k}^{(p+1)}=0 \quad k\in R\\
x_{ijk}^{(p)}x_{ijk}^{(p+1)}=0 \quad k\in (G\cup \{k=16\})\\
\sum_{k\in G}^{}x_{ijk}^{(p)}=0 \quad i\notin D\\
x_{i1(16)}^{(p)}\left(\sum_{j=1}^{2}\sum_{k\in R}^{} x_{ijk}^{(p)}\right) = 0 \quad i\in L\\
\sum_{k\in R/R_1}^{} x_{i1k}^{(p)} + \sum_{k\in R_1}^{} x_{i2k}^{(p)} = 0, \quad i\in L\\
\sum_{k\in R/R_1}^{} x_{i1k}^{(p)} + \sum_{k\notin F}^{} x_{i2k}^{(p)} = 0, \quad i\in N\\
\sum_{i\in N,k\in F}^{} x_{ijk}^{(p)} + \sum_{j=1}^{2}\sum_{i\notin N,k\in F}^{} x_{ijk}^{(p)} = 0\\
\sum_{i\in L,k\in R/R_1}^{} x_{j1k}^{(p)} + \sum_{j=1}^{2} \sum_{i\notin L,k\in R/R_1}^{} x_{ijk}^{(p)} = 0\\
\sum_{k\notin G}^{} x_{ijk}^{(p)} = 0 \quad i\in D;x_{i1(16)}^{(p)} = 0 \quad i\notin L\\
x_{ijk}^{(p)} \ge \frac{1}{2}A_i\text{sgn}(x_{ijk}^{(p)})\\
\sum_{t=0}^{2}\sum_{k\in M}^{} x_{ijk}^{(p+t)} >0\\
\sum_{k\in R/R_1}^{} \text{sgn}(x_{i2k}^{(p)}) \leq 1 \quad i\in L\\
\sum_{k=1}^{n} x_{ijk}^{(p)} \leq A_i;\sum_{k}^{} \text{sgn}(x_{ijk}^{(p)}) \leq 1, \quad i\in D\\
x_{ijk}^{(p)} \ge 0; \quad x_{ijk}^{(p)}=0,i\in Z,k\in R/R_1\\
M = \{k| k=1,2,\cdots,5,17,18,19\}\\
D = \{i| i=1,2,\cdots,26\};L = \{i| i=27,28,\cdots,34\}\\
N = \{i| i=35,36,\cdots,50\};G = \{k| k=1,2,\cdots,15\}\\
R_1=R/\{k=35,36,37\};Z = \{i| i=51,52,\cdots,54\}\\
R = \{k| k=17,18,\cdots,37\};F = \{k| k=38,39,40,41\}\\
\end{gathered}
\right.
\end{equation}
\end{document}
参考阅读(lshort-zh-cn
链接):
问 mactex 中文内容显示的问题:\usepackage{ctexart}无法显示中文