有群友于 2025-03-9 反馈称确实会在这一步出现卡住的情况,但这似乎是这个页面的bug,实际上的.log
文件已经安装结束了(如果你等得足够久的话),你可以测试下查看.log
能否看到形如“欢迎来到TeX的世界”之类的欢迎语,如果可以,应该是可以(通过ctrl+Z或者ctrl+C)之类的方法关闭的。
有群友于 2025-03-9 反馈称确实会在这一步出现卡住的情况,但这似乎是这个页面的bug,实际上的.log
文件已经安装结束了(如果你等得足够久的话),你可以测试下查看.log
能否看到形如“欢迎来到TeX的世界”之类的欢迎语,如果可以,应该是可以(通过ctrl+Z或者ctrl+C)之类的方法关闭的。
在usrguide
中,如@u101077 老师所言,要使用\NewExpandableDocumentCommand
才可以在表格内正确展开,但与此同时又有如下限制:
无法将唯一的参数定义为O
型...
我不太懂展开,也不太懂是否有好的办法绕开这一限制,但OP又说:
我知道有很多表格宏包能做这件事情。我的问题是如何自定义具有一个可选参数的thickhline命令?或者有没有其他打包控制表格线粗细命令的方法?
因此我虽然发现booktabs
中的toprule
命令完全符合这一要求...但不确定OP是否“允许”站在前人的肩膀上,下面是直接偷Plain-TeX的方法,个人觉得这样的话,这个横线命令应该会比自己定义的更sound...
\documentclass{article}
\makeatletter
\newdimen\myheavyrulewidth
\myheavyrulewidth=1.5bp %<-default width here
\newdimen\belowrulesep
\newdimen\belowbottomsep
\newdimen\aboverulesep
\newdimen\abovetopsep
\newdimen\@aboverulesep
\newdimen\@belowrulesep
\newcount\@thisruleclass
\newcount\@lastruleclass
\@lastruleclass=0
\newdimen\@thisrulewidth
\def\futurenonspacelet#1{\def\@BTcs{#1}%
\afterassignment\@BTfnslone\let\nexttoken= }
\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo}
\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree
\else\let\next=\nexttoken\fi \next}
\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= }
\def\Thickhline{\noalign{\ifnum0=`}\fi%<- modified from \toprule
\@aboverulesep=\abovetopsep
\global\@belowrulesep=\belowrulesep %global cos for use in the next noalign
\global\@thisruleclass=\@ne
\@ifnextchar[{\@BTrule}{\@BTrule[\myheavyrulewidth]}}%<- modified here
\def\@BTrule[#1]{%
\ifx\longtable\undefined
\let\@BTswitch\@BTnormal
\else\ifx\hline\LT@hline
\nobreak
\let\@BTswitch\@BLTrule
\else
\let\@BTswitch\@BTnormal
\fi\fi
\global\@thisrulewidth=#1\relax
% \ifnum\@thisruleclass=\tw@\vskip\@aboverulesep\else
% \ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
% \ifnum\@lastruleclass=\@ne\vskip\doublerulesep\fi\fi\fi
\@BTswitch}
\AtBeginDocument{%
\providecommand*\CT@arc@{}}%% colortbl support
\def\@BTnormal{%
{\CT@arc@\hrule\@height\@thisrulewidth}%
\futurenonspacelet\@tempa\@BTendrule}
\def\@BLTrule{\@ifnextchar({\@@BLTrule}{\@@BLTrule()}}
\def\@@BLTrule(#1){\@setrulekerning{#1}%
\global\@cmidlb\LT@cols
\ifnum0=`{\fi}%
\noalign{\ifnum0=`}\fi
\futurenonspacelet\@tempa\@BTendrule}
\def\@BTendrule{\ifx\@tempa\toprule\global\@lastruleclass=\@thisruleclass
\else\ifx\@tempa\midrule\global\@lastruleclass=\@thisruleclass
\else\ifx\@tempa\bottomrule\global\@lastruleclass=\@thisruleclass
\else\ifx\@tempa\cmidrule\global\@lastruleclass=\@thisruleclass
\else\ifx\@tempa\specialrule\global\@lastruleclass=\@thisruleclass
\else\ifx\@tempa\addlinespace\global\@lastruleclass=\@thisruleclass
\else\global\@lastruleclass=\z@\fi\fi\fi\fi\fi\fi
% \ifnum\@lastruleclass=\@ne\relax\else\vskip\@belowrulesep\fi
\ifnum0=`{\fi}}
\makeatother
\begin{document}
\begin{tabular}{ll}
\Thickhline
a & b \\
\hline
c & d \\
\Thickhline[1bp]
\end{tabular}
\end{document}
感觉抄的很不整洁(neat),上面应该还存在一些可以删的unused
命令...
可以缩短mwe:
\documentclass{beamer}
\usepackage{cleveref}
\begin{document}
\begin{frame}
Hello, world!
\end{frame}
\end{document}
甚至可以只是:
\documentclass{article}
\usepackage[implicit=false]{hyperref}
\usepackage{cleveref}
\begin{document}
Hello, world!
\end{document}
maybe related link:
OP的一个来源on TSE
一点小探索,一般的宏包在使用global option指定选项之后,均可以通过:\<package>setup
之类的命令实现覆盖(overwritten),但这对于hyperref
并不奏效,查看hyperref.sty
(需要pdflatex hyperref.dtx
)可以发现:
当传入impilicit=false
时,由于:
%Line2283 将其默认值设置为true
\define@key{Hyp}{implicit}[true]{%
\Hy@boolkey{implicit}{#1}%
}
同时这会触发所谓的patch external commands
% Line 4179~4203
\ifHy@implicit
\Hy@InfoNoLine{Implicit mode ON; LaTeX internals redefined}%
\else
\Hy@InfoNoLine{Implicit mode OFF; no redefinition of LaTeX internals}%
\def\MaybeStopEarly{%
\Hy@Message{Stopped early}%
\Hy@AtBeginDocument{%
\PDF@FinishDoc
\gdef\PDF@FinishDoc{}%
}%
\endinput
}%
\Hy@AtBeginDocument{%
\let\autoref\ref
\let\autopageref\pageref
\ifx\@pdfpagemode\@empty
\gdef\@pdfpagemode{UseNone}%
\fi
\global\Hy@backreffalse
}%
\Hy@AtEndOfPackage{%
\global\let\ReadBookmarks\relax
\global\let\WriteBookmarks\relax
}%
\fi
%Line 4521~4540
\ifHy@implicit
\let \T@Ref\HyRef@Ref
\def\@refstar#1{%
\NR@ref@showkeys{#1}%
\HyRef@StarSetRef{#1}\@firstoffive
}
\def\@pagerefstar#1{%
\NR@ref@showkeys{#1}%
\HyRef@StarSetRef{#1}\@secondoffive
}
\def\@namerefstar#1{%
\NR@ref@showkeys{#1}%
\HyRef@StarSetRef{#1}\@thirdoffive
}
\def\@Refstar#1{%
\NR@ref@showkeys{#1}%
\HyRef@StarSetRef{#1}\HyRef@MakeUppercaseFirstOfFive
}%
\else
\fi
且与此同时在:
% Line4204
\Hy@DisableOption{implicit}
这也解释了即使使用\hypersetup{}
在main.tex
中再次显式设置implicit
选项,也无法修改beamer.cls
中\RequirePackage[implicit=false]{hyperref}
的显式设置的原因.
我猜这种设计是因为implicit
所进行的操作均为内部patch,因此disabled了用户从外部修改implicit
的接口以防止奇怪的更改。
不知道有没有猜对你的需求,也许是局部横排...
\documentclass{book}
\usepackage[a4paper,margin=1in]{geometry}% latex默认的版心很小,可以用geometry包调整
\usepackage{ctex}
\usepackage{amsmath,amsthm,amssymb,amscd}
\usepackage{setspace}
\usepackage{makecell,booktabs,multirow}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{zhlipsum}
\usepackage{pdflscape}
\begin{document}
\begin{equation}\label{Choquard}
E=mc^2
\end{equation}
\zhlipsum[1-2]
\begin{landscape}
\begin{table}[tp]
\setcellgapes{10pt}%设置行高
\makegapedcells
\setlength{\abovecaptionskip}{0cm}
\setlength{\belowcaptionskip}{0.2cm}
\caption{{\color{red}方程 \eqref{Choquard} 的国内外研究现状}}
\resizebox{.83\paperheight}{!}{%
\begin{tabular}{|c|c|c|c|c|c|}
\hline
\textbf{作者} & \textbf{年份} & \multicolumn{2}{|c|}{\textbf{条件}} & \textbf{研究方法} & \textbf{主要结论}\\
\hline
E. H. Lieb & 1977 & \makecell[c]{$N=3,\mu=2,$ \\$f(u)=u$} & $V\equiv 1$ & 极小化方法&存在正解且在平移意义下唯一\\
\hline
P.L. Lions &1980 & 同上 & $V\equiv\lambda>0$ & 极小化方法 & 存在无穷多个球对称解$\{u_{n}\}$,其中 $u_{1}$正解\\
\hline
\makecell[c]{B.Buffoni, L. Jeanjean,\\ C. A. Stuart} & 1993 & 同上 & \makecell[c]{$V\in L^{\infty}(\mathbb{R}^{3})$\\ $V$ 周期函数} & 算子理论的应用 & 存在解\\
\hline
N.Ackermann & 2004 & \makecell[c]{$N\geq1$\\ $I_\mu(x)=W(x)$} & $V$ 周期函数 & 一般的环绕方法 & \makecell[c]{存在解\\
若 $f$ 是奇的, 则方程\eqref{Choquard} 有无穷多解}\\
\hline
\makecell[c]{V. Moroz,\\ J. Van Schaftingen} & 2013 & \makecell[c]{$N\geq1,\mu\in (0,N)$ \\$f(u)=|u|^{p-2}u$}&$V\equiv 1$&\makecell[c]{极小化方法 \\Pohozaev恒等式}&\makecell[c]{全面地讨论了对不同的$p$值,方程\eqref{Choquard}\\解(基态解)的(不)存在性、正性、正则性以及无穷远处的衰减性}\\
\hline
\makecell[c]{V. Moroz,\\ J. Van Schaftingen}&2015&\makecell[c]{$N\geq3,\mu\in (0,N)$ \\$f(u)$一般增长项}&$V\equiv 1$&\makecell[c]{极小化(极大极小)方法 \\Pohozaev恒等式}&\makecell[c]{方程\eqref{Choquard}存在基态解\\ 若方程\eqref{Choquard}有解$u$,则$u\in W_{loc}^{2,q}(\mathbb{R}^{N})$,\ $q\geq1$}\\
\hline
\makecell[c]{Z. Huang, J. Yang,\\ W. Yu} &2017&\makecell[c]{$N=3,\mu=2,$ \\$f(u)=|u|^{p-2}u,\;p\in (\frac{5}{2},5)$}&$V\equiv 1$& $Nehari$流形方法 &\makecell[c]{$\forall k\in \mathbb{Z}^{+}$方程至少有一个球对称解,\\ 且这个解恰好变号$k$次}\\
\hline
\makecell[c]{D. Qin,V. R\u{a}dulescu\\ X. Tang} & 2021 &\makecell[c]{$N\geq 2, I_\mu(x)=W(x)$\\ $W$ 非负, 偶
} & $V$ 周期函数 & \makecell[c]{$Nehari$流形方法\\
空间分解}& \makecell[c]{存在基态解\\
若 $f$ 是奇的, 则有无穷多解}\\
\hline
\makecell[c]{R. N. de Lima, \\ M. A. S. Souto} & 2023 & $N\geq1,\inf\limits_{x\in\mathbb{R}^{N}}V(x)> 0 $ & \makecell[c]{$V$ 关于前 $L$ 个分量周期;\\$V$ 关于后$M$个分量强制\\
(周期强制)}& 极大极小方法 &\makecell[c]{方程\eqref{Choquard}有山路正解;\\若 $V$ 对称强制,则方程\eqref{Choquard}有正解
}\\
\hline
\end{tabular}
}
\end{table}
\end{landscape}
\zhlipsum[1-2]
\end{document}
PS.MWE做的挺好的,但下次最好要贴PDF编译的效果,同时准确描述/图示你的需求
这个问题其实是因为\CJKunderline
实际上模仿的是ulem
的方法,因此该问题实际上可以进一步简化为ulem
与footnote
的冲突。
下面是一个不优雅的workaround:
\documentclass[b5paper,twoside,openany,UTF8,no-math]{ctexbook}
\usepackage{color}
\usepackage{xeCJKfntef}
\xeCJKsetup{underline={%
format = \color{yellow},
thickness = 1.25\ccwd,
depth = -1.0\ccwd,
}
}
\usepackage{soul}
\usepackage{ulem}
\begin{document}
这是一段测试文字,\CJKunderline*{其中这些文字用xeCJKfntef宏包高亮,但是这些文字\mbox{\footnotemark} 的注释显示异常。}\footnotetext{显示异常的注释。}
I can eat the glass and it doesn't hurt me.I can \uline{eat the glass and it doesn't hurt\mbox{\footnotemark} me}.I can eat the glass and it doesn't hurt me.\footnotetext{note with ulem}
I can eat the glass and it doesn't hurt me.I can \hl{eat the glass and it doesn't hurt\footnote{the footnote in hl} me}.I can eat the glass and it doesn't hurt me.
I can eat the glass and it doesn't hurt me.I can \ul{eat the glass and it doesn't hurt\footnote{the footnote in hl} me}.I can eat the glass and it doesn't hurt me.
\end{document}
同时还发现基于soul
宏包实现的高亮不会影响footnote
.
从公式的含义来说, 这个两行的公式应该共享同一个编号。
如何实现这样的排版
个人觉得更好的办法是使用amsmath
宏包提供multline
环境,从这个公式来看,我认为你这里并不需要按照某个位点对齐,而仅仅是长公式折行。
\documentclass[aspectratio=169,10pt,notes=show]{beamer}
\usepackage{amsmath}
\begin{document}
\begin{frame}
\begin{multline}
\left[\mathcal{E} + eV - \frac{1}{2m}\left(\mathbf{p} + \frac{e}{c}\mathbf{A}\right)^2 + \frac{1}{2m_0c^2}\left(\mathcal{E} + eV\right)^2\right. \\
\left. + i\frac{e\hbar}{(2m_0c)^2}\mathbf{E}\cdot\mathbf{p} - \frac{e\hbar}{2m_0c}\boldsymbol{\sigma}\cdot\mathbf{B} - \frac{e\hbar}{(2m_0c)^2}\boldsymbol{\sigma}\cdot\left(\mathbf{E} \times\mathbf{p}\right)\right]\psi = 0
\end{multline}
\end{frame}
\end{document}
为什么会报错?
可以见这个链接的介绍。
查看emotion宏包发现支持xelatex编译
是在何处看到的?我在文档里没有看到。
\emotion{A}
这个用法是在何处获知?
实际测试发现xelatex
确实不可行,lualatex
可以顺利运行...
\documentclass[12pt,a4paper]{ctexart}
\usepackage{emotion}
\emotionsetup{Twemoji Mozilla}
\begin{document}
你好
\emotion{A} % 这个A你是在哪里看到的...
% \emotion{🇦}
\emotion{☃}
\emotion{☘}
\emotion{☝}
\emotion{☠}
\emotion{🥵}
\emotion{✌🏾}
\emotiondef{apple}{🍎}
\emotiondef{tea}{🍵}
\emotion{apple}
\emotion{tea}
你好
\end{document}
我不是很懂lualatex
,但使用xelatex
编译出现如下警告:
Package fontspec:
(fontspec) Ignored LuaTeX-only feature:
(fontspec) 'Renderer=Full/Basic/Node/Base/HarfBuzz'.
在emotion.sty
中我们可以看到:
%Line 8~14
% add emotion command
\newfontface \emotionfont: { Twemoji~Mozilla } [ Renderer = Harfbuzz ]
% enable update emoji font
\newcommand{\emotionsetup}[1]{
\renewfontface \emotionfont: {#1} [ Renderer = HarfBuzz]
}
此处已经指定了似乎只有luatex
才支持的fontspec
选项Renderer = Harfbuzz
,这有可能是xelatex
编译不出emoji的一个原因。
PS.剑豪体中文字体的设置与本问题无关,不需要写在mwe内。且提问时插入代码必须使用markdown的围栏代码块。
TWO related links may be help...
我觉得使用floatrow
以及subcaption
宏包提供的类似capbesideposition={left,top}
的位置控制命令会更好,但到饭点了...有缘再尝试,也建议你尝试并自答。
\
....还有一个小问题,提供代码应该提供完整代码以减少潜在的回答者的工作量,同时照片请使用example-image
(这是TL自带的mwe
宏包里的.pdf
图片),不然在别人电脑上无法编译你的"聚焦1c.png".
貌似是和subfigrue
包冲突了?
属于可能的宏包冲突问题,你如果不提供最小工作示例,没有人能预料到你的代码又调用了什么其他宏包,你必须用一个最短的文档进行测试,试图找到冲突的宏包,不建议在长篇的论文中测试。
实际上参照这个solution,并不需要调用已经过时的subfig
宏包,你提供的信息非常有限。
\documentclass{ctexart}
\usepackage{geometry}
\usepackage{floatrow}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{hyperref}
\renewcommand\thesubfigure{\alph{subfigure}}
\begin{document}
我要索引子图AA\ref{sfig:testa}啊啊啊啊,我还要索引子图BB\ref{sfig:testb}啊啊啊啊啊,我最后还要索引子图BB\ref{sfig:testc}啊啊啊啊。我最后还要索引整个图片\ref{fig:test}啊啊啊啊。
\begin{figure}
\floatsetup[subfigure]{%
style=plain,%
heightadjust=object,%
capbesideposition={left,top},%
capbesidesep=columnsep,%
}
\ffigbox[\FBwidth]
{%
\useFCwidth%
\begin{subfloatrow}[3]%
\fcapside[\FBwidth]%
{\caption{}\label{sfig:testa}}
{\includegraphics[width=4cm]{example-image-a}}
\fcapside[\FBwidth]%
{\caption{}\label{sfig:testb}}
{\includegraphics[width=4cm]{example-image-b}}
\fcapside[\FBwidth]%
{\caption{}\label{sfig:testc}}
{\includegraphics[width=4cm]{example-image-c}}
\end{subfloatrow}%
}
{\caption{A figure with three subfigures}\label{fig:test}}
\end{figure}
\end{document}
另附MWE定义:
多行公式里有括号的数学公式
是什么意思?按照你的mwe,编译出来的效果为:
除了需要使用\text{其他}
而不是只在数学公式内直接打其他
之外,并没有明显的问题。建议使用目标示意图表示“多行公式里有括号的数学公式”的准确效果。
如果想要编号的不同样式,可见下面的maybe related link:
请提供一个完整的可编译的文档例子,例如format.cls
具体是什么,只提供一个切片很难回答这一问题。
一个基于natbib
的例子如下,需要使用pdf-bibtex-pdf-pdf
或者latexmk -pdf
命令编译:
\documentclass{article}
\begin{filecontents*}[overwrite]{reference.bib}
@article{1966Calculation,
author = {AAAA},
year = {1966},
title = {Calculation of the Influence of the Earth's Magnetic Field on the Magnetic Field of the Moon},
}
@article{1972Influence,
author = {BBBB},
year = {1972},
title = {The Influence of Earth's Magnetic Field in Exploring the world},
}
@article{2000The,
author = {CCCC},
year = {2000},
title = {The The The The paper named The The The},
}
\end{filecontents*}
\usepackage[numbers,sort&compress]{natbib}
\bibliographystyle{unsrtnat}
\begin{document}
I want to cite these papaer at here\cite{1966Calculation,1972Influence,2000The} but not there!
\bibliography{reference}
\end{document}
根据我自己给自己做的MWE(真是有够好笑了呢)
\documentclass[12pt,a4paper,openany,twoside]{ctexbook}
\usepackage{geometry}
\begin{filecontents*}[overwrite]{paper.bib}
@article{1966Calculation,
author = {AAAA},
year = {1966},
title = {Calculation of the Influence of the Earth's Magnetic Field on the Magnetic Field of the Moon},
}
@article{1972Influence,
author = {BBBB},
year = {1972},
title = {The Influence of Earth's Magnetic Field in Exploring the world},
}
@article{2000The,
author = {CCCC},
year = {2000},
title = {The The The The paper named The The The},
}
\end{filecontents*}
\usepackage[numbers,sort&compress]{natbib}%加上这一行即可...
\paperheight=15cm % 只是为了截图在同一张图内
\begin{document}
\tableofcontents
\chapter{绪\quad 论}
\section{标题}
\subsection{副标题}
这是引用\cite{1966Calculation,1972Influence,2000The}的结果——我想我能吞下玻璃而不伤身体。
\bibliographystyle{gbt7714-2005}
\bibliography{paper.bib}
\addcontentsline{toc}{chapter}{参考文献}
\end{document}
BTW,你是否看过基础教程lshort-zh-cn
的6.1节....
提供在网上可以公开获得的代码时最好应该贴代码链接而不是直接上传文件,所以相比于直接上传jiazhu.dtx
,更好的办法是贴这个官方链接。
参考muzimuzhi在这个链接中提供的方法,需要使用如下的方法编译:
先使用xetex jiazhu.dtx
释放jiazhu.sty
以及jiazhu.ins
等文件
再使用xelatex jiazhu.dtx
在当前目录下已有jiazhu.sty
的前提下可以获得jiazhu.pdf
的帮助文档
只需要使用release
的ctex-kit
中最新版本(截至2025-03-03,只要在2024-03-19之后即可)的ctxdoc.cls
即可顺利编译jiazhu.dtx
。为避免版本困惑,这里贴一个截至2025-03-03(其实是2024-03-19)开发版本的ctxdoc.cls
。ctxdoc.cls
一个简略的说明:2023年10月份JosephWright将l3kernel中部分命令的x-type
替换为e-type
展开这一软性更新,直接影响了作为测试文档类的l3doc.cls
中的部分命令,而ctxdoc.cls
由于依赖了l3doc.cls
文档类,而jiazhu.dtx
又依赖于ctxdoc.cls
。
上面的上游l3doc.cls
中的修改对应的ctxdoc.cls
部分命令的修改已经在2023年-2024年间陆续被PR,但由于ctex
发版较慢,目前CTAN上的ctxdoc.cls
仍然是2022-06-05发版的v2.5ctex-kit
版本,上面“对部分命令的修改已经在2023年~2024年间陆续被PR(#704) ”并未体现在用户的TeXLive2024/2025
中。
目前已经发现的ctxdoc.cls
中的命令替换和对应的PR(都已经被merged,因此使用开发版本但未发版的ctxdoc.cls
即可):
\__codedoc_get_hyper_target:xN
被替换为\__codedoc_get_hyper_target:eN
这一替换可见PR #678\tl_replace_all:Non
被替换为\tl_replace_all:NVn
这一替换可见PR #700\__codedoc_macroname_prefix:o
以及\__codedoc_macroname_suffix:N #2
命令 这一替换可见PR #703类似的问题在这个latexstudio提问的评论区以及这个关于fduthesis的源文件编译问题还有这个易经宏包的说明文档也有提到过,最简单的办法都是是直接使用被PR
后最新版(而非CTAN上最后发版的2022年的ctex-kit
)的ctxdoc.cls
,当然,也可以如上手动备份并修改ctxdoc.cls
的部分命令。
安装开发版本的ctex-kit
也很简单,克隆仓库后到ctex
目录下执行l3build install
,就会自动安装到用户目录的texmf
目录,在编译时优先被调用。
atxy_blip老师在这个issues里提到的基于l3build
使用开发版本的ctex-kit
的方法可以直接安装到texmf
路径内。当然如果保险起见,也可以手动备份或者只添加到当前目录。
Release "jiazhu-beta" 包含了编译好的jiazhu.pdf
。截至 2025-03-02,jiazhu.dtx
在发这个非正式版后,只有一个重构的提交f85a422
,所以那份jiazhu.pdf
够用了,jiazhu
包的使用者没有自行编译文档的必要性。想自行编译文档的,就超出了使用者范畴,可以尝试如前所述git clone
的步骤。
muzimuzhi老师在这个issues提到的直接获得jiazhu.pdf
的方法。此处顺便贴一份jiazhu.pdf
的文件。jiazhu.pdf
在我这里可以正常编译:
啸行老师指出:
建议你用二分法找找错误出现的地方
简单补充下这句话的意思,下次请务必自己给出最简代码,也能帮助你定位错误,不要提出标题为“不知道什么错误 烦死了 内容都是完整的”的问题了,你完全可以在探索之后问出“如何在行间公式内输入中文”一类的标题。
\documentclass{article}
\usepackage{ctex,amsmath}
\title{二队关于插值的理解(主要来源与司守奎老师)}
\author{二队\and 为啥\thanks{这次我了解到并知道怎么会用脚注了}
\and 就是
\and 就是就是}
\date{\today}
\begin{document}
\maketitle
\section{导言}
在数学建模过程中,通常要处理由试验、测量得到的大量数据或一些过于复杂而不便于计算的函数表达式,针对此情况,很自然的想法就是,构造一个简单的函数作为要考察教据或复杂函数的近似。插值和拟合就可以解决这样的问题。\par
至于拟合先就抛开不谈。\par
说到插值首先得明白插值能干什么,什么时候适合用,我觉得这比插值本身这件事情重要,所以本文会先就谈谈不同的插值方法的适合情况,进而说明对应的插值方法。\par
\section{一维插值}
\subsection{相关概念}
已知好多数据点,假设有n+1个互不相同的观测点$x_0,x_1,x_2,\ldots,x_n$处的观测值,寻求一个近似曲线(或叫做近似函数),使其满足
\begin{equation}
f(x_i) = y_i,i=0,1,\ldots,n。\label{pythagorean}
\end{equation}
对于任意的非观测点$\hat{x}(\hat{x} \neq x_i,i=0,1,\ldots,n)$,要估计该点的函数值就可以用$f(\hat{x})$。通常此类问题称为插值问题。而求近似函数\eqref{pythagorean}的方法称为插值方法。\par
观测点$x_i(i=0,1,\ldots,n)$称为插值节点,$f(x)$称为插值函数(也称之前说过的近似函数,近似曲线),式\eqref{pythagorean}称为插值条件,含$x_i(i=0,1,\ldots,n)$的最小区间$[a,b]$称为插值区间。$f(\hat{x})$为x在$\hat{x}$处的插值。\par
值得注意的是,若$\hat{x}\in[a,b]$,则称为内推,否则称为外推。所以有什么影响呢,插值方法一般适用于内推的情况。外推需谨慎,仅适用于短期预测,长期预测可靠性低。
如果插值函数为多项式函数,则称插值方法为多项式插值。之前说过用什么插值方法取决与求什么类型的插值函数。
这周确实忙,所以先就说一下牛顿插值跟拉格朗日插值。而且应该对于数据预处理还要学很长时间。
\subsection{拉格朗日插值方法}
求插值多项式比较方便的做法不是待定系数法解方程。而是巧妙的构造一组基函数。
\begin{equation}
l_i(x) =\frac{(x - x_0)\cdots(x - x_{i-1})(x - x_{i+1})\cdots(x - x_n)}{(x_i - x_0)\cdots(x_i - x_{i-1})(x_i - x_{i+1})\cdots(x_i,x_n)}
则$l_i(x)$是n次多项式,满足
\begin{equation}
\end{document}
报错信息为:
LaTeX Warning: Reference `pythagorean' on page 2 undefined on input line 21.
! Missing $ inserted.
<inserted text>
$
l.29
大约是在29行有问题以上的代码显然还不是最简
于是我们试试注释25行之前,\begin{document}
之后的代码:
\documentclass{article}
\usepackage{ctex,amsmath}
\title{二队关于插值的理解(主要来源与司守奎老师)}
\author{二队\and 为啥\thanks{这次我了解到并知道怎么会用脚注了}
\and 就是
\and 就是就是}
\date{\today}
\begin{document}
\subsection{拉格朗日插值方法}
求插值多项式比较方便的做法不是待定系数法解方程。而是巧妙的构造一组基函数。
\begin{equation}
l_i(x) =\frac{(x - x_0)\cdots(x - x_{i-1})(x - x_{i+1})\cdots(x - x_n)}{(x_i - x_0)\cdots(x_i - x_{i-1})(x_i - x_{i+1})\cdots(x_i,x_n)}
则$l_i(x)$是n次多项式,满足
\begin{equation}
\end{document}
再次编译,发现问题仍然存在:
! Missing $ inserted.
<inserted text>
$
l.13
这说明删对了,接着继续尝试删除代码,由于正文区已经剩下的内容很少了...
\documentclass{article}
\usepackage{ctex,amsmath}
\begin{document}
\begin{equation}
l_i(x) =\frac{(x - x_0)\cdots(x - x_{i-1})(x - x_{i+1})\cdots(x - x_n)}{(x_i - x_0)\cdots(x_i - x_{i-1})(x_i - x_{i+1})\cdots(x_i,x_n)}
则$l_i(x)$是n次多项式,满足
\begin{equation}
\end{document}
同样可以复现你的问题(有相同的报错),所以问题就出现在上面的这一段中。
通过上面的操作,你也可以发现问题其实就集中在equation
环境中...也就不会提出“不知道什么错误 烦死了 内容都是完整的”这样的标题了...
从昨晚交流群的信息来看,你编译名为未命名12.tex
在texpad中显示出了中文“未命名”乱码之外一切正常
我猜测texpad仅仅是把终端的结果经过parser放到error panel而已,因此texpad不应该被怪罪,问题应该出现在你的终端编码不支持中文上
我建议你在终端测试如下六个文件:
xelatex
编译看看效果xelatex
编译看看效果xelatex
编译看看报错信息xelatex
编译看看报错信息pdflatex
编译pdflatex
编译提供这六种情况在终端是否乱码,同时请尝试按下图提供你当前终端的默认编码方式:
问 安装2025卡在在最后一步