请提供在别人的电脑上如何复现你的问题。无法复现的问题是玄学。不应该被提问。
建议你在vscode右下角的编码处尝试修改编码方式。
(感觉这份文件烂完了...)
请提供在别人的电脑上如何复现你的问题。无法复现的问题是玄学。不应该被提问。
建议你在vscode右下角的编码处尝试修改编码方式。
(感觉这份文件烂完了...)
使用tcolorbox
宏包的默认样式即可。
请在终端输入texdoc tcolorbox
,或者看这个链接。
请给一份完整的可直接编译的代码,并且分点详细说明哪些部分还不满意,以方便潜在的回答者逐一解决。
昨天修习了一下zref-lastpage
,如果不想用圈圈的话,可以试试下面的代码:
P.S.在calc
宏包中提供了名为\ratio
的用于计算两个<dim>
之比,最好是不要使用\ratio
作为宏的名称
\documentclass[tikz,border=5pt]{standalone}
\usepackage[totpages,lastpage]{zref}
\usetikzlibrary{calc}
\def\hlen{1.25cm}
\def\headradius{10pt}
\def\hwidth{2cm}
\def\hfillwidth{.567*\hwidth}
\newcommand*\pageProgressBar{%
\ifnum\ztotpages=0\relax
\def\myratio{1}
\else%
\pgfmathsetmacro{\myratio}{\value{page}/\ztotpages}
\fi
\def\hfillwidth{\myratio*\hwidth}
\begin{tikzpicture}[scale=3]
\draw[rounded corners = \headradius, fill = black!30] (0,0) rectangle ++ (\textwidth, .5cm);
\fill[rounded corners = \headradius, fill = violet!90] (0,0) rectangle ++ (\myratio*\textwidth, .5cm);
\end{tikzpicture}
}
\begin{document}
\foreach \p in {1, ..., 20}{%
\pageProgressBar
\newpage
}
\end{document}
(上述甚至抄了一些鱼老师的代码和思路)
LastPaage
索引的数值问题可以通过refcount
提供的\getrefbykeydefault
命令获取,或者直接通过zref-lastpage
获得;这里有一个较为详细的总结~LastPage
的值的取得需要等第一轮编译到shipout
阶段之后把页码信息(应该恰好是\@abspage@last
)写入.aux
内,而使用\ztotpages
等方法在第一轮的初始值是0(使用\@abspage@last
的初始值为\maxdimen
),因为这里需要在不能获取到LastPage
的时候先编译tikz
的计算,因此对第一轮需要进行特殊判断以避免除零错误。这一过程写入.aux
是由latex自动完成的,而如果需要写入其他信息,可以参考雾月老师的这个解答,或者使用zref
的机制写入新的property。maybe related in the hypererf
documentation:
我尝试对你的MWE缩了一下行...并试着结合啸行老师的做法给了一个尝试...
\documentclass[UTF8,a4paper,openany]{book} %% openany可以让你的页面少几面
\usepackage{ctex}
\ctexset{
contentsname={\textit{Contents}},
listfigurename={\zihao{3}\centering List of figures},
bibname={References},
}
\usepackage[colorlinks=true]{hyperref}
\usepackage{graphicx}
\begin{document}
WWW
QQQ
\newpage
\phantomsection
\addcontentsline{toc}{chapter}{ABSTRACT}
\centerline{\bfseries ABSTRACT}
AAA
\tableofcontents
\listoffigures
\addcontentsline{toc}{chapter}{LIST OF FIGURES}
\ExplSyntaxOn
\int_step_inline:nn {4}{%
\chapter{Chapter \int_to_Roman:n {#1}}
\section{111}
\section{222}
\section{333}
\int_step_inline:nn {4}{%
\begin{figure}
\centering
\includegraphics{example-image}
\caption{figure-{##1}}
\end{figure}
}
}
\ExplSyntaxOff
\begin{thebibliography}{9}
\bibitem{111} 1111
\bibitem{222} 222
\bibitem{333} 333
\bibitem{444} 444
\end{thebibliography}
\addcontentsline{toc}{chapter}{REFERENCES}
\end{document}
请看VCR:
我没看出来的你的图示是按什么对齐的,你的图示看上去很丑......
可能的正确示例如下:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
SSE &= \sum_{i=1}^n(y_i-\hat{y_i})\\
SST &= \sum_{i=1}^n(y_i-\bar{y})
\end{align*}
\end{document}
在公式环境不可以空行!!!你的MWE并不work...
\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\begin{align}
SSE = \sum_{i=1}^n(y_i-\hat{y_i})\notag\\
SST = \sum_{i=1}^n(y_i-\bar{y})\notag\\
\end{align}
\end{document}
倒数第三行!!!不允许空行!!!
这将会报错:
SSE = \sum _{i=1}^n(y_i-\hat {y_i})\notag \\ SST = \sum _{i=1}^n(y_i\ETC.
! Paragraph ended before \align was complete.
<to be read again>
\par
l.9
@u141196 如果我没有记错的话,你的上一个问题还没有做任何回复。提问请不要突然消失。
如果是“如何输入这些图标”,我们默认这是在标准文档类下进行的,下面是最简单的MWE:
% LuaLaTeX
\documentclass{article}
\usepackage{fontawesome5}
\usepackage{xcolor}
\colorlet{accent}{blue!70!black}
\begin{document}
\faIcon{qq}
\faIcon{github}
\textcolor{red}{\faIcon{qq}}
\textcolor{accent}{\faIcon{github}}
\end{document}
如若不然,请说明你的准确需求。同时,一个问题请只聚焦一个目标。
我也抽空试了下...核心基本都是用decorations.pathreplacing
提供的brace
:
\documentclass[tikz,border=5pt]{standalone}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\draw (0,.15) -- (0,0) node[left,yshift=.12cm] {Hello} -- (5,0) -- (5,.15) decorate [decoration={brace,amplitude=5pt}] { (0,.15) -- (5,.15) node[midway,yshift=.35cm] {50 dollars}};
\draw (0,-1+.15) -- (0,-1) node[left,yshift=.12cm] {Hello} -- (7,-1) -- (7,-1+.15) (0,-1-.15) -- (0,-1) (7,-1-.15) -- (7,-1) decorate [decoration={brace,,amplitude=5pt,mirror}] { (0,-1-.15) -- (7,-1-.15) node[midway,yshift=-.53cm] {70 dollars}};
\draw (5,-1+.15) decorate [decoration={brace,amplitude=5pt}] { -- (7,-1+.15) node[midway,yshift=.35cm] {? dollars}};
\draw[dashed] (5,0) -- (5,-1);
\end{tikzpicture}
\end{document}
@u3945 但是同时有个小建议:
应该使用markdown的围栏代码块将你的代码包围,否则会出现丢失\
的现象,你可以使用“补充回答”功能,让这部分代码正确高亮。
PS.国外不知道有没有线段图这一称呼,不知道有没有造好的轮子。
@u686 Thanks to David Carilsle again🙌
感觉舍弃:\thickline
以及 \thickline[<dim>]
使用:\thickline{}
以及 \thickline{<dim>}
在这种情况下也并非就很用户不友好(算是一种trade off between 代码量 与 syntax的易用性 ...)
仍然不太优雅(本可以避免一些dummy的语句的)... 就当抛砖引玉了... 一定有更符合tikz-style更优雅的办法:
我下面取了个巧,利用重复绘制右⚪来规避计算交点坐标,因为从OP的目标和工作量权衡来看,显式得到这两个坐标似乎不是必须的...
基本思路:
\documentclass[border=8pt,tikz]{standalone}
\usepackage{amssymb}
\usetikzlibrary{patterns}
\begin{document}
\begin{tikzpicture}
\path [draw,very thick,->] node at (-.3,-.3) {$O$} (-0.5,0) -- (8,0) node[anchor=north] {$x$};
\path [draw,very thick,->] (0,-0.5) -- (0,6.1) node[anchor=east] {$y$};
\node at (7.5,5.5) {$\mathbb{R}^{2}$};
\draw[very thick,blue,dashed,-] (0.5,0.5) -- (6.5,0.5) -- (6.5,5) --(0.5,5)--(0.5,0.5);
\node at (6.2,1) {$\Lambda$};
\node at (5.5,3) {$S$};
\draw (5,3) circle (1.2);
\draw[fill=white] (3,3) circle (1.5);
\draw[dashed] (5,3) circle (1.2);
\draw[pattern=north west lines,draw=red] (3,3) circle (1.5);
\node[fill=white,rounded corners,below of=3] at (2.5,4) {$B$};
\node at (2,1.3) {$ {\color{red}\partial B=B_{0}}$};
\end{tikzpicture}
\end{document}
MWE编译报错啊,缺少amsmath
宏包...
\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\begin{equation*}
y=\beta_0 + \beta_{1}X
\end{equation*}
\lipsum[2]
\[
y=\beta_0 + \beta_{1}X
\]
\lipsum[2]
\end{document}
BTW,lshort-zh-cn第四章都有吧...
有群友于 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编译的效果,同时准确描述/图示你的需求
问 tex文件中文乱码,无法解决