请注意MWE的定义,以及上一个回答里让你注意的几点问题:
label
设置还是不对,可以加上tabularray
等更为相关的tag
内容经过测试,你的Large (No-)Working Example的问题是:
Line 214行
Line 269行
Line 336行
的\tweek
命令,缺少必选参数,修改为\tweek{#1}
可以解决你的问题
另外,制作Minimal Working Example的过程可以有效提高你的debug能力,是可以很快找到这个错误的
用latex3
的循环语法练习了一下,基本上大大缩短了你的代码长度(大概缩了一半吧...)
遇到比较大的问题是tabularray
的expand
展开选项在遇到l3
时有点不好处理...
非常感谢鱼先生 @u19850 给出的使用\expandafter
方法展开拼接字符串的方法,同时也感谢外国友人Ulrike Fischer提供的莫大帮助和提示
% trick to concat the items
\def\mycontent{}
\expandafter\def\expandafter\mycontent\expandafter{
\mycontent
<codes want to put together>
}
下面是缩行成功的MWE:
\documentclass[twoside]{book}
\usepackage[
letterpaper,
bindingoffset=15mm,
textheight=250mm,
textwidth=175mm,
top=1in,
bottom=20mm,
footskip=0.5in,
marginparwidth=0mm,
marginparsep=0mm,
margin = .6in
]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{kpfonts}
\usepackage{tabularray}
\pagestyle{plain}
\raggedright
\raggedbottom
\begin{document}
\ExplSyntaxOn
\clist_const:Nn \c_wwws_clist { What, Who, How, When, Where, Why }
\clist_const:Nn \c_questions_clist {
{What~do~I~want~to~achieve?},
{Who~benefits?~Whose~help~do~I~need?},
{Which~skills~do~I~need?},
{What~is~my~timeline?},
{Where~will~I~accomplish~this?},
{Why~is~this~goal~important~to~me?}
}
\clist_const:Nn \c_goals_clist {
{Annual~Goal},
{Monthly~Sub-Goals~for~Annual~Goal},
}
\int_step_inline:nn {7}
{
\int_step_inline:nn {2}
{
\newpage
\begin{center}
{
\Large \textbf{{\clist_item:Nn \c_goals_clist {##1}}~\#~#1~}
}
\end{center}
\vspace{5mm}
\noindent
\def\mycontent{}
\int_step_inline:nn {6}
{
%迭代合并\mycontent内容的trick
\int_compare:nTF{##1=1}{
\expandafter\def\expandafter\mycontent\expandafter{
\mycontent
\SetCell[r=4]{c}{\clist_item:Nn \c_wwws_clist {####1}} & {\clist_item:Nn \c_questions_clist {####1}} \\
& \\ & \\ & \\
}
}{
\expandafter\def\expandafter\mycontent\expandafter{
\mycontent
\SetCell[r=4]{c}{Sub-Goal\\~\#~####1} & {} \\
& \\ & \\ & \\
}
}
}
\begin{tblr}[expand=\mycontent]{
width=175mm,
colspec={ X[1,c] X[8,l] },
vlines,hlines,
rows={7mm, m, rowsep=1.0pt},
font=\bfseries,
}
\mycontent
\end{tblr}
\newpage
}
}
\ExplSyntaxOff
\end{document}
效果如下:
另外,需要注意的是:
.tex
文件,并且说明是在forloop
中插入第二个tblr
会导致\item
错误label
(标签)应尽量是<package name>
,<keyword of your question>
等对问题有概括性/便于分类的tag
,请问下这个文件为啥去掉后面这几行能运行
有这几行就会报错呢
把后面这几行拿出来又能运行
这些label
非常不搭.嗯..我找不到你所谓的cmex.pfb
字体文件,只能用yhcmex.pfb
代替
经过测试..似乎如下图设置可行【view】-【Fit to font bounding box】
你对各种字体真的很执着?此外,本问题与latex实际上可以说并无确切关联,是否应发到论坛上(?)
另外,有个问题希望你顺便补充一下,这个回答中 https://ask.latexstudio.net/ask/question/17415.html
"想要所有的数学符号,如int,sum,langle,rangle, sqrt等等,都变成Computer Modern math的字体" 什么是所有的数学符号,既然你想用所有的默认"cmu"数学符号,那为什么又要使用sitx数学字体呢?你上面指的所有数学符号列表是否是有限的呢?
参考TSE上的回答:https://tex.stackexchange.com/questions/14386/importing-a-single-symbol-from-a-different-font。基本思路也是“偷”,我不觉得你用的上那么多的数学符号。能否更确切地描述你另一个问题的需求,Eureka在交流群中也提出了类似的疑问。
您好,我不太确定这个问题的best practice是什么,但也许可以考虑unicode-math
提供的range
选项.
如下图所示,由于我找不到这个代码了,暂无法提供文本形式的代码...
你好,请提供最小工作示例的文本
你上面的代码并不能直接复制就可以编译得到效果。
另一方面,我进行类似测试是完全可以实现你的需求的,你需要提供最小的一份可以复现你的问题的代码。
可以考虑使用\scriptscriptstyle
减小字号或者使用\!
插入负间距,如下mwe:
\documentclass{article}
\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}
\[ g_{ijk} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{IJK} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{\scriptscriptstyle {IJK}} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{\text{IJK}} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{I,J,K} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{\scriptscriptstyle {I,J,K}} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{I\!J\!K} (\mathbf{R}_j,\mathbf{R}) \]
\[ g_{I\!\!J\!\!K} (\mathbf{R}_j,\mathbf{R}) \]
\end{document}
我比较笨...
也不擅长TiKZ...
只能给出一条线一条线慢慢画的回答
..下面的代码其实还有很对可以改进的地方,比如一些代码复用,部分定位仍需要手动调整,部分连接处似乎是因为浮点误差有些小瑕疵等,部分位置的微调你自己看texdoc tikz
文档调整吧
我不喜欢TiKZ!
\documentclass[margin=1.5cm]{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{positioning,calc,intersections}
\begin{document}
\begin{tikzpicture}[
every node/.style = {circle,outer sep=0pt,inner sep=.1pt},
lineleft/.style = {color = red!80,dashed,line cap=round},
lineright/.style = {color = green!70!black,line cap=round},
]
\node (node-22) {$a_{22}$};
\node (node-21) [left = of node-22] {$a_{21}$};
\node (node-23) [right = of node-22] {$a_{23}$};
\node (node-12) [above = of node-22] {$a_{12}$};
\node (node-11) [left = of node-12] {$a_{11}$};
\node (node-13) [right = of node-12] {$a_{13}$};
\node (node-32) [below = of node-22] {$a_{32}$};
\node (node-31) [left = of node-32] {$a_{31}$};
\node (node-33) [right = of node-32] {$a_{33}$};
\node (extra-north) [above = of node-12] {\phantom{$a_{12}$}};
\node (extra-east) [right = of node-23] {\phantom{$a_{23}$}};
\node (extra-west) [left = of node-21] {\phantom{$a_{21}$}};
\node (extra-south) [below = of node-32] {\phantom{$a_{32}$}};
\node (extra-southeast) [right = of node-33] {\phantom{$a_{31}$}};
\node (extra-southwest) [left = of node-31] {\phantom{$a_{31}$}};
\node (M1) at ($(node-11)!.5!(extra-west)$) {};
\node (M2) at ($(node-11)!.5!(extra-north)$) {};
\node (N1) at ($(node-13)!.5!(extra-east)$) {};
\node (N2) at ($(node-13)!.5!(extra-north)$) {};
\draw[lineright]
(extra-north.center) -- (node-13) -- (extra-east.center)
(M2.center) -- (node-12) -- (node-23) -- (extra-southeast)
(node-11) -- (node-22) -- (node-33)
(M1.center) -- (node-21) -- (node-32)
(extra-west.center) -- (node-31) -- (extra-south.center)
;
\draw[lineleft]
(extra-west.center) -- (node-11) -- (extra-north.center)
(N2.center) -- (node-12) -- (node-21) -- (extra-southwest)
(node-31) -- (node-22) -- (node-13)
(N1.center) -- (node-23) -- (node-32)
(extra-south.center) -- (node-33) -- (extra-east.center)
;
\draw[lineright,name path=circ1] let \p1 = ($(M2.center) - (extra-west.center)$),
\n{radius} = {veclen(\x1,\y1)/2}
in
(M2.center) arc (45:225:\n{radius});
\draw[lineright,name path=circ2] let \p1 = ($(M1.center) - (extra-north.center)$),
\n{radius} = {veclen(\x1,\y1)/2}
in
(extra-north.center) arc (45:225:\n{radius});
\draw[lineleft,name path=circ3] let \p1 = ($(N2.center) - (extra-east.center)$),
\n{radius} = {veclen(\x1,\y1)/2}
in
(N2.center) arc (135:-45:\n{radius});
\draw[lineleft,name path=circ4] let \p1 = ($(N1.center) - (extra-north.center)$),
\n{radius} = {veclen(\x1,\y1)/2}
in
(extra-north.center) arc (135:-45:\n{radius});
\draw[lineright,line cap=round,name intersections={of=circ1 and circ2}] (intersection-1)-- (node-11);
\draw[lineleft,line cap=round,name intersections={of=circ3 and circ4}] (intersection-1)-- (node-13);
\node[rectangle] (text1) [below left=.8cm of extra-west,xshift=1.05cm] {\textcolor{red!80}{$-a_{1,1}a_{2,3}a_{3,2}$}};
\draw[lineleft] (text1.north) -- (extra-west.center);
\node[rectangle,xshift=.1cm] (text2) at (extra-southwest) {\textcolor{red!80}{{$-a_{1,2}a_{2,1}a_{3,3}$}}};
%\draw[lineleft] (text2.north) -- (node-21);
\node[rectangle] (text3) [below left=.5cm of node-31,xshift=1cm] {\textcolor{red!80}{$-a_{1,3}a_{2,3}a_{3,1}$}};
\draw[lineleft] (text3.north) -- (node-31);
\node[rectangle] (text4) [below right=.8cm of extra-east,xshift=-1cm] {\textcolor{green!70!black}{$+a_{1,3}a_{2,1}a_{3,2}$}};
\draw[lineright] (text4.north) -- (extra-east.center);
\node[rectangle,xshift=.1cm] (text5) at (extra-southeast) {\textcolor{green!70!black}{$+a_{1,2}a_{2,3}a_{3,1}$}};
% %\draw[lineright] (text5.north) -- (node-23);
\node[rectangle] (text6) [below right=.5cm of node-33,xshift=-1cm] {\textcolor{green!70!black}{$+a_{1,1}a_{2,2}a_{3,3}$}};
\draw[lineright] (text6.north) -- (node-33);
\end{tikzpicture}
\end{document}
效果如下:
提供mwe还是要完整...
tocbibind
宏包会将由thebibliography
生成的参考文献加入目录,但是你也不应该同时使用\section*{参考文献}
新增一个section
,这样会在参考文献处出现两行“参考文献”。
所以,你还是需要提供完整的mwe才好防止可能出现的其他问题...
虽然MWE还是不太规范,但至少你学会了围栏代码块语法...
似乎找到了你模仿的原文档代码,分析你的报错信息,提示Error: Bad column type
,说明是S
列格式 不能被识别,文档中写的很清楚,需要加载siunitx
宏包...
另外 [code-before = ... ]
似乎是已经过时的接口,请关注最新版的nicematrix
文档
下面才是正常的MWE(需要包含\documentclass
到\end{docuement}
的全部内容啊不然怎么直接复制就能编译...)
\documentclass[12pt]{ctexart}
\usepackage{hyperref}
\usepackage{nicematrix}
\usepackage{booktabs}
\usepackage{siunitx}
\begin{document}
\section{NiceMatrix}
\begin{NiceTabular}[c]{lSSSS}
\CodeBefore
\rowcolor{red!15}{1-2}
\rowcolors{3}{blue!15}{}
\Body
\toprule
\Block{2-1}{Product} &
\Block{1-3}{dimensions (cm)} & & &
\Block{2-1}{\rotate Price} \\
\cmidrule(rl){2-4}
& L & l & h \\
\midrule
small & 3 & 5.5 & 1 & 30 \\
standard & 5.5 & 8 & 1.5 & 50.5 \\
premium & 8.5 & 10.5 & 2 & 80 \\
extra & 8.5 & 10 & 1.5 & 85.5 \\
special & 12 & 12 & 0.5 & 70 \\
\bottomrule
\end{NiceTabular}
\end{document}
请将代码放置到围栏代码块语法中,以保证正确的高亮
建议使用【补充问题】功能,并在编辑完毕后善用【预览】功能
同时建议提供完整的mwe
摸鱼的时候测试了一下,下面是一个MWE:
\documentclass[12pt]{ctexart}
\usepackage{amsmath}
\usepackage{cases}
\usepackage{empheq}
\setlength{\parindent}{0pt}
\begin{document}
原始的表达(cases或者\verb|\left\{\right.|方法)均难以在cases内部编号:
\begin{equation}
\left\{
\begin{aligned}
B&=B_{\text{地}}+B_{++}+B_{s}+B_{sl} \\
B&=B_{\text{地}}+B_{++}^{prime}+B_{s}-B_{sl}
\end{aligned}
\right.
\end{equation}
\begin{equation}
\begin{cases}
B = B_{\text{地}} + B_{++} + B_{s} + B_{sl}\\
B = B_{\text{地}} + B_{++}^{prime} + B_{s} - B_{sl}
\end{cases}
\end{equation}
solution1:\verb|cases|环境中分行添加序号可以使用\verb|cases|宏包提供的\verb|numcases|环境实现(注意该宏包须在\verb|amsmath|之后调用).
\begin{numcases}{}
B=B_{\text{地}}+B_{++}+B_{s}+B_{sl} \\
B=B_{\text{地}}+B_{++}^{prime}+B_{s}-B_{sl}
\end{numcases}
solution2:使用\verb|empheq|宏包提供的环境来实现大括号内的多行编号
\begin{empheq}[left=\empheqlbrace]{align}
B &= B_{\text{地}} + B_{++} + B_{s} + B_{sl}\\
B &= B_{\text{地}} + B_{++}^{prime} + B_{s} - B_{sl}
\end{empheq}
\end{document}
怀疑是calculations
环境的bug
可以将下图所示的 值从默认的0.3修改为更大的值(例如0.48),这是出现当columns=2
时整体向左偏移的原因
之后代码编译宽度正常
本弹性强迫症也来给一个briefly summary:
参考自tse上的另一个回答,大致有以下三种方案:
amsthm
宏包ntheorem
宏包thmtools
宏包方案一:
\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{lipsum,zhlipsum}
\newtheoremstyle{no-bracket}
{\topsep}
{\topsep}
{\normalfont\itshape}
{0pt}
{\bfseries}
{} %{:}
{\newline}
%{\thmname{#1}~\thmnumber{#2}\thmnote{ \textlangle#3\textrangle}}
{\thmname{#1}~\thmnumber{#2}\thmnote{ #3: }}
\theoremstyle{no-bracket}
\newtheorem{theorem}{定理}[section]
\begin{document}
\noindent 使用\verb|amsthm|宏包的\verb|\newtheoremstyle|修改参数\verb|<CUSTOM-HEAD-SPEC>|实现
\section{这是一个章节}
\begin{theorem}[Fundamental Theorem of Algebra]
\lipsum[2]
\end{theorem}
\begin{theorem}[代数学基本定理]
Fundamental Theorem of Algebra
\end{theorem}
\begin{theorem}[代数学基本定理]
\zhlipsum[1]
\end{theorem}
\end{document}
方案二:
\documentclass[12pt]{ctexart}
\usepackage{amsmath}
\usepackage{lipsum,zhlipsum}
\usepackage{ntheorem}
\makeatletter
\newtheoremstyle{no-bracket}
{
\item[
\rlap{\vbox{\hbox{\hskip\labelsep
\theorem@headerfont ##1\ ##2\theorem@separator}
\hbox{\strut}}}
]
}%
{
\item[
\rlap{\vbox{\hbox{\hskip\labelsep
\theorem@headerfont ##1\ ##2\ ##3: \theorem@separator}\hbox{\strut}}}
%冒号加在这里不会有空格
]
}
\makeatother
\theoremstyle{no-bracket}
%\theoremseparator{:} %出现空格
\newtheorem{theorem}{Theorem}
\begin{document}
\noindent 使用\verb|ntheorem|宏包的\verb|\newtheoremstyle|命令
\section{这是一个章节}
\begin{theorem}[Fundamental Theorem of Algebra]
\lipsum[2]
\end{theorem}
\begin{theorem}[代数学基本定理]
Fundamental Theorem of Algebra
\end{theorem}
\begin{theorem}[代数学基本定理]
\zhlipsum[1]
\end{theorem}
\end{document}
方案三:
\documentclass[10pt,a4paper]{ctexart}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{lipsum,zhlipsum}
\usepackage{thmtools} %
\declaretheoremstyle[
spaceabove=\topsep,
spacebelow=\topsep,
headfont=\normalfont\bfseries,
notefont=\bfseries,
notebraces={}{},
bodyfont=\normalfont\itshape,
postheadspace=\newline,
headpunct={:},
]{no-bracket}
\declaretheorem[style=no-bracket,name=Theorem]{theorem}
\begin{document}
\noindent 使用\verb|thmtools|宏包的\verb|\declaretheoremstyle|命令设置
\section{这是一个章节}
\begin{theorem}[Fundamental Theorem of Algebra]
\lipsum[2]
\end{theorem}
\begin{theorem}[代数学基本定理]
Fundamental Theorem of Algebra
\end{theorem}
\begin{theorem}[代数学基本定理]
\zhlipsum[1]
\end{theorem}
\end{document}
我来自己提供一个tabularray
的方法....
%\usepackage{xcolor}
%\usepackage{tabularray}
\begin{tblr}{
hlines,
vlines,
colspec = {cQ[c,cyan7]Q[c,azure7]Q[c,blue7]},
row{1} = {bg=cyan},
hline{3} = {2-4}{red},
hline{5} = {2-4}{cyan},
hline{7} = {2-4}{violet},
cell{2}{1} = {r=2,c=1}{c,orange!60},
cell{4}{1} = {r=2,c=1}{c,orange!60},
cell{6}{1} = {r=2,c=1}{c,orange!60},
}
$\beta$ & $50$ & $100$ & $150$ \\
静态工作点& AAA & BBB & CCC \\
& DDD & EEE & FFF \\
动态工作点& AAA & BBB & CCC \\
& DDD & EEE & FFF \\
等离子态工作点& AAA & BBB & CCC \\
& DDD & EEE & FFF \\
\end{tblr}
问 在svg文件里正常,但是导到overleaf后这些文字全部偏离,请问怎么解决?