无法复现。请提供更多的详细信息(例如OS,系统版本,宏包版本,确保关闭其他应用程序)。
使用WPS是治标不治本的行为。
TeXLive2025
windows11
一切正常
TeXLive2025
windows11
一切正常
那个ishort感觉有些已经不够了 所以去哪里找比较好的学习资源呢
首先是L-short
不是I-short
.
你的这个问题是源自于"自定义表格的需求"
lshort里大致介绍了:
tabular
环境的用法tabularx
控制列宽\multicolumn
以及\multirow
控制合并单元格booktabs
也做了详细的入门讲解,关键是你没注意到红圈那里的细节...那个ishort感觉有些已经不够了
我觉得不是不够,而是你目前阅读的不是太仔细,90%的入门问题都可以通过lshort-zh-cn
解决。
所以去哪里找比较好的学习资源呢 我现在很多都不知道 都不知道某一个用法对应的宏包 很迷茫
读完入门教程之后,个人觉得合适的路径是结合自己的需求,找针对性的文档去看,例如下面:
当你需要排版斜线表头,你总可以在互联网上获知diagbox
这个包,使用texdoc diagbox
你就可以看到详细用法,学习文档并用到你的代码中
当你需要跨页表格,你可能会搜索到longtable
。同样的,使用texdoc longtable
呼出文档
你可能还会有更细致的表格排版要求,你还会听到“tabularray
优雅永不过时”这样的说法,这时你可以去了解下texdoc tabularray
看看其效果....例如下面比较fancy的表格效果...
texdoc
命令,多看文档是进一步学习LaTeX
的必由之路吧...我也是在lshort-zh-cn
中找到你这个case里的合适方法的
\documentclass[12pt]{ctexart}
% \usepackage[showframe]{geometry}
\usepackage{tabularx}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}[!htbp]
\centering
\begin{tabularx}{\textwidth}{*{3}{>{\centering\arraybackslash}X}}
\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}
编译查看报错信息:
! Undefined control sequence.
<inserted text> {Xcc} \toprule
[1.5pt] 符号 & 说明 & 单位\\ \midrule [...
l.15 \end{tabularx}
意思是,未定义的控制序列\toprule
为什么LaTeX
不认识\toprule
,因为需要booktabs
宏包
还有,不需要显式写出粗细[1.5pt]
等;编译中文需要ctex
宏包
\documentclass[12pt]{ctexart}
\usepackage{tabularx} % 需导入宏包
\usepackage{amsmath}
\usepackage{booktabs}
\begin{document}
\begin{table}[!htbp]
\centering
\caption{这是一个三线表}
\begin{tabularx}{\textwidth}{Xcc}
\toprule
符号 & 说明 & 单位\\
\midrule
5 & 269.8 & 0.04089\\
10 & 421.0 & 0.04089\\
20 & 640.2 & 0.04089\\
\bottomrule
\end{tabularx}\label{tab:001}
\end{table}
我要索引 表\ref{tab:001} 啊哈啊.
\end{document}
不知道你是不是在找「section」如何设置pagebreak
的惩罚(?)
我尝试找了下:
$ article.cls, line302
\newcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries}}
以及:
% latex.ltx, line 15606:
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec \leavevmode \fi
\par
\@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@
\@tempskipa -\@tempskipa \@afterindentfalse
\fi
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
\@ifstar
{\@ssect{#3}{#4}{#5}{#6}}%
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
其中
\if@nobreak
\everypar{}%
\else
\addpenalty\@secpenalty\addvspace\@tempskipa
\fi
似乎 设置了\section
后的惩罚。可惜,我不懂TeX
....
可能有关:https://github.com/CTeX-org/ctex-kit/issues/434#issuecomment-493402258
注:「source-han」和「noto-serif-CJK-SC(实际上就是fontset=ubuntu
调用的)」均为「思源字体」,只是分发的公司不同而已。
那么这些汉字支持是怎么实现的?
感觉问的有点泛了...我不懂字体....
也许有关: https://liam.page/2016/12/11/LaTeX-traditional-font-scheme/
是不是依靠...\texlive\2024\texmf-dist\tex\generic\ctex\zhmap下的ctex-zhmap-founder.tex
文件实现的?
是。在sec4.3
中,zhmap=true
时默认行为调用了zhmetrics
读取ctex-zhmap- #4 .tex
中的配置:
源码可参见ctex
文档的sec14.3.2:ctex-engine-pdftex.def
:
% \ctex_load_zhmap:nnnn
% 载入 zhmetrics 的字体映射文件,同时设置 \CJKrmdefault 等。
512 \cs_new_protected:Npn \ctex_load_zhmap:nnnn #1#2#3#4
513 {
514 \tl_set:Nn \CJKrmdefault {#1}
515 \tl_set:Nn \CJKsfdefault {#2}
516 \tl_set:Nn \CJKttdefault {#3}
517 \ctex_set_zhmap:n { \ctex_file_input:n { ctex-zhmap- #4 .tex } }
518 }
519 \@onlypreamble \ctex_load_zhmap:nnnn
520 }
附:
在v2.5的changlog中提到:
General: ubuntu 改用思源(Noto CJK)和文鼎字库,不再支持使用 pdfLATEX
编译。
这个修改的代码内容可见这个链接,也许研究下修改之前的配置可以部分回答你的原问题. 粗看上面的修改,之前的fontset=ubuntu
是因为使用的是「文泉驿」字体(支持pdftex
),修改为「Noto」之后不支持了。
后者似乎是texhigh
用的方式:
% texhigh.prelude.ths Line101
\@ifpackageloaded{tikz}{\@texhighload@tikztrue}{}
\newbox\texhigh@picturebox
\if@texhighload@tikz
\RequirePackage{tikz}
\usetikzlibrary{shadings}
\usetikzlibrary{fill.image}
\protected\def\texhigh@shadetext#1#2{%
\setbox\texhigh@picturebox=\hbox{{\texhigh@pdfliteral{7 Tr }#2}}%
\tikz[baseline=0,line width=0pt]\path\pgfextra{\rlap{\copy\texhigh@picturebox}}
[#1] (0,-\dp\texhigh@picturebox) rectangle (\wd\texhigh@picturebox,\ht\texhigh@picturebox);}
\tikzset{texhigh/.is family,
texhigh/gradient primitive/.style={left color=blue,right color=cyan},
texhigh/gradient ?/.style={left color=red,right color=blue},
texhigh/gradient-style/.style={texhigh/gradient #1}}
\THSaveStyle{tikz.gradient}{%
\THSetClassCS{latex}{\texhigh@underline{\THcolor{purple}\bfseries#1#2}}
\THSetClassCS{primitive}
{\texhigh@shadetext{texhigh/gradient-style=primitive}{\bfseries #1#2}}%
\THSetClassCS{?}{\texhigh@shadetext{texhigh/gradient-style=?}{#1#2}}%
}
看上去是浮点误差所致(?)
\documentclass{standalone}
\usepackage{tikz}
% \usepackage{xfp}%
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\def\a{0.1}
\def\t{65}
\def\l{0.2}
\def\w{1.4}
\def\ws{0.8}
\foreach \i in{1,2,...,7}
{
\pgfmathparse{\i*0.20+13.35}
\let\s=\pgfmathresult
\node[anchor=north,inner sep=2pt] at (0,\i) {$\s$ and $\fpeval{\i*0.20+13.35}$};
}
\end{tikzpicture}
\end{document}
是最小工作示例代码...
并非最小。
xe
编译才会出现『无法加粗』的现象,啸行的回答老师才是更好的正解。如果非用xelatex
不可:
learnt from here
ieeetrans
的投稿需求,或者换言之,这是不是最佳实践,我不清楚。% main.tex
% https://tex.stackexchange.com/a/495519/322482
\renewcommand{\encodingdefault}{OT1}
\documentclass[journal]{IEEEtran}
\begin{document}
\section{Introduction}
For peer review papers
\textbf{creates the second title.}
{\bfseries aaaaa}
\end{document}
附件一直上传不上来,就只好贴链接了
论坛传输文件有大小限制。实际上,当你触及这一限制时,说明你并没有做MWE,而是把调试大段代码的任务直接甩手交给别人...
模板编译报错,不知道具体原因
当你遇到报错,务必贴报错信息。
注意项目的文件结构和上述信息判断:
找不到./font/
下的字体呗...
1.方法一,『为所有人安装』上述路径下的字体后刷新缓存
2.方法二,注意到:
% cumcmthesis.cls % Line 128
\RequirePackage{fontspec}
\newfontfamily\yaheiconsola{YaHei.Consolas.1.11b.ttf}
\newfontfamily\monaco{MONACO.TTF}
\setmonofont[
Contextuals={Alternate},ItalicFont = Fira Code Retina Nerd Font Complete.otf % to avoid font warning
]{YaHei.Consolas.1.11b.ttf}
使用Path
选项指定路径。
\RequirePackage{fontspec}
\newfontfamily\yaheiconsola[Path = ./font/,]{YaHei.Consolas.1.11b.ttf}
\newfontfamily\monaco[Path = ./font/]{MONACO.TTF}
\setmonofont[
Path = ./font/,
Contextuals={Alternate},
ItalicFont = Fira Code Retina Nerd Font Complete.otf% to avoid font warning
]{YaHei.Consolas.1.11b.ttf}
之后编译又报错
! LaTeX Error: Unknown option `classicReIm' for package `kpfonts-otf'.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.80
我不懂字体,参考这个
将
%五一模板.tex %Line9
\usepackage[classicReIm]{kpfonts}
替换为xe
友好的
\usepackage[fancyReIm]{kpfonts-otf}
如发现其他问题,请⌈补充问题⌋,并具体指明效果差异。并尽可能给更短的MWE,过长的代码0人想看。
请提供你的操作系统(是否是windows?)
同时你需要提供你所说的『ctex做的tex文件』的.tex
文件内容,或者测试如下的最简代码:
\documentclass{ctexart}
\begin{document}
你好 \LaTeX\ 世界!
\end{document}
看看问题是否存在。有可能是安装时提前关闭了安装界面,进而没有做好字体配置所致(?)
记录昨晚失败的尝试...
本意是希望改写\NewTblrDashStyle
命令的样式,以便自定义[dashdot]
类似的样式来,也许是最佳实践....我把它续问在了这里
但是tabularray
宏包在使用solid
,dotted
以及dashed
这些样式时使用的是手动绘制rule
的方式,这使得进行类似的拓展变得比较困难...
🤨🤨🤨...
必须在 overleaf (texlive 2024)上实现或下图 tabularray 版本的宏包,如不行提供 texlive 以及相关宏包的版本。
我的版本信息为2025-A
,提供了更好的tikz
支持,如果需要在overleaf
上使用,你也可以upload最新版的tabularray.sty
:
*File List*
ctexart.cls 2022/07/14 v2.5.10 Chinese adapter for class article (CTEX)
ctexbackend.cfg 2022/07/14 v2.5.10 Backend configuration file (CTEX)
expl3.sty 2025-03-26 L3 programming layer (loader)
l3backend-xetex.def 2025-03-14 L3 backend support: XeTeX
ctexhook.sty 2022/07/14 v2.5.10 Document and package hooks (CTEX)
ctexpatch.sty 2022/07/14 v2.5.10 Patching commands (CTEX)
fix-cm.sty 2020/11/24 v1.1t fixes to LaTeX
ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file
ctexopts.cfg 2022/07/14 v2.5.10 Option configuration file (CTEX)
article.cls 2024/06/29 v1.4n Standard LaTeX document class
size10.clo 2024/06/29 v1.4n Standard LaTeX file (size option)
ctex-engine-xetex.def 2022/07/14 v2.5.10 XeLaTeX adapter (CTEX)
xeCJK.sty 2022/08/05 v3.9.1 Typesetting CJK scripts with XeLaTeX
xtemplate.sty 2024-08-16 L3 Experimental prototype document functions
fontspec.sty 2024/05/11 v2.9e Font selection for XeLaTeX and LuaLaTeX
xparse.sty 2024-08-16 L3 Experimental document command parser
fontspec-xetex.sty 2024/05/11 v2.9e Font selection for XeLaTeX and LuaLaTeX
fontenc.sty 2021/04/29 v2.0v Standard LaTeX package
fontspec.cfg
xeCJK.cfg 2022/08/05 v3.9.1 Configuration file for xeCJK package
zhnumber.sty 2022/07/14 v3.0 Typesetting numbers with Chinese glyphs
zhnumber-utf8.cfg 2022/07/14 v3.0 Chinese numerals with UTF8 encoding
ctex-scheme-chinese-article.def 2022/07/14 v2.5.10 Chinese scheme for article (CTEX)
ctex-name-utf8.cfg 2022/07/14 v2.5.10 Caption with encoding UTF-8 (CTEX)
ctex-c5size.clo 2022/07/14 v2.5.10 c5size option (CTEX)
ctex-fontset-windows.def 2022/07/14 v2.5.10 Windows fonts definition (CTEX)
ctex.cfg 2022/07/14 v2.5.10 Configuration file (CTEX)
tabularray.sty 2025-03-11 v2025A Typeset tabulars and arrays with LaTeX3
varwidth.sty 2009/03/30 ver 0.92; Variable-width minipages
tikz.sty 2023-01-15 v3.1.10 (3.1.10)
pgf.sty 2023-01-15 v3.1.10 (3.1.10)
pgfrcs.sty 2023-01-15 v3.1.10 (3.1.10)
pgfrcs.code.tex
pgfcore.sty 2023-01-15 v3.1.10 (3.1.10)
graphicx.sty 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
keyval.sty 2022/05/29 v1.15 key=value parser (DPC)
graphics.sty 2024/08/06 v1.4g Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2023/12/02 v1.11 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
xetex.def 2022/09/22 v5.0n Graphics/color driver for xetex
pgfsys.sty 2023-01-15 v3.1.10 (3.1.10)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2023-01-15 v3.1.10 (3.1.10)
pgfsysprotocol.code.tex 2023-01-15 v3.1.10 (3.1.10)
xcolor.sty 2024/09/29 v3.02 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
mathcolor.ltx
ninecolors.sty 2022-02-13 v2022D Select colors with proper color contrast
pgfcore.code.tex
pgfcomp-version-0-65.sty 2023-01-15 v3.1.10 (3.1.10)
pgfcomp-version-1-18.sty 2023-01-15 v3.1.10 (3.1.10)
pgffor.sty 2023-01-15 v3.1.10 (3.1.10)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
下面是MWE:
\documentclass{ctexart}
\usepackage{tabularray}
\UseTblrLibrary{tikz}
\begin{document}
\begin{table}[ht]
\centering
\caption{\textbf{????}}
\begin{tblrtikzabove}
\draw[dash dot]
(2-2.north east) -- (16-2.south east);
\end{tblrtikzabove}
\begin{tblr}{colspec = {c|cc|c}}
\hline
\textbf{???} & \SetCell[c=2]{c}\textbf{???} && \textbf{??}\\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}??? & ?? & ?? & \SetCell[r=3]{c}???\\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=6]{c}?? & ?? & ?? & \SetCell[r=6]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
?? & ?? & ?? & ??\\
\hline
\SetCell[r=3]{c}?? & ?? & ?? & \SetCell[r=3]{c}?? \\
\hline
& ?? & ?? & \\
\hline
& ?? & ?? & \\
\hline
\end{tblr}
\end{table}
\end{document}
maybe related: https://ask.latexstudio.net/ask/question/17595.html
\parindent
以及\indent
和\noindent
的作用,少用\\
如非必要,勿增实体。只用了amsthm
的功能实现...
\documentclass[12pt]{ctexbook}
\usepackage[showframe]{geometry}
\usepackage{amsmath,amsthm}
% \usepackage{hyperref}
\newtheoremstyle{qaqstyle}
{3pt} % Space above
{3pt} % Space below
{} % Body font
{1cm} % Indent amount(修改间距)
{\bfseries} % Theorem head font
{:} % Punctuation after theorem head(冒号)
{.5em} % Space after theorem head
{\thmname{#1}\thmnumber{ #2}.\thmnote{ #3}} % Theorem head spec (can be left empty, meaning `normal')
\theoremstyle{qaqstyle}%切换为新样式
\newtheorem{example}{例}[section]
\setlength{\parindent}{0pt}%取消段前缩进
\begin{document}
% 1\\%这一行的缩进是默认的\parindent
对比
\hspace{1cm}对比:你应该用theorem的title, 而不是自己手动输入『\texttt{\char92 textbf{椭球面:}}』
\begin{example}[椭球面]
$\frac{x^{2}}{a^{2}}+\frac{y^{2}}{b^{2}}+\frac{z^{2}}{c^{2}}=1$
\end{example}
\end{document}
所以我最后打算直接把bibtex
生成的列表隐藏掉,自己写一个列表上去。但是直接注释掉\bibliography{thesis-references}
会导致文章中的参考文献出错,不知道怎么解决?
你想要“自己写一个列表上去”是一个非常坏和反人类的做法。正常情况下,bibliography
和正文内的\cite
是一个label-ref对
的引用关系,不应该“自己写一个列表上去”。你应该比较标准的比如gbt7714
的样式与你目标样式的差异,再尝试修改.bst
,用规范标准的bibtex
工作流来实现『参考文献』.如果你想要去掉\bibliography
,那你就不能在正文进行\cite
...这是不规范的,也是不合理的.
打算直接把bibtex
生成的列表隐藏掉
如果_一定要_实现隐藏...可以尝试用这个方法...
\documentclass[fontset=ubuntu]{ctexart}
\usepackage{bibentry}
\usepackage{gbt7714}
\bibliographystyle{gbt7714-numerical}
% https://tex.stackexchange.com/a/142845/322482
\begin{document}
Here is a cite\cite{article-full}.
这是另一处中文引用\cite{misc-full}.
\nobibliography{xampl}
\end{document}
我用item来新写一个列表,发现序号是右对齐的,查了很久不知道怎么修改
大致理解成你希望label
左对齐,使用enumitem
宏包的align=left
选项即可:
\documentclass{ctexart}
\usepackage{enumitem}
\begin{document}
\begin{enumerate}[label={[\arabic*]},align=left,start=8]
\item 我能吞下玻璃而不伤身体.
\item 我能吞下玻璃而不伤身体.
\item 我能吞下玻璃而不伤身体.
\item 我能吞下玻璃而不伤身体.
\end{enumerate}
\end{document}
另外你这些参数{itemsep=2pt, partopsep=0pt, parsep=\parskip, topsep=5pt, itemindent = 0pt, labelindent = 10pt}
都是确实需要的吗....
\documentclass
开始到\end{document}
结束. BTW,一个问题应该只聚焦在一处,你有两处疑惑,正常情况下应该提两个问题.
问 如何在LaTeX文档中插入pdf文档