是的, 当你使用 \int_new:N
时系统会为你分配一个整数寄存器, 而你的 \l_test_int
只是它的别名? 过程类似于?
\newcount\count291
\let\l_test_int=\count291
你要调试它的值可以使用
\int_show:N \l_test_int
\int_log:N \l_test_int
将会得到
> \l_test_int=5.
是的, 当你使用 \int_new:N
时系统会为你分配一个整数寄存器, 而你的 \l_test_int
只是它的别名? 过程类似于?
\newcount\count291
\let\l_test_int=\count291
你要调试它的值可以使用
\int_show:N \l_test_int
\int_log:N \l_test_int
将会得到
> \l_test_int=5.
(1).
\int_new:N \l_loop_var
\int_step_variable:nnNn {10} {20} \l_loop_var {
这是第~\l_loop_var~个数\par
}
其实你这里的第一行没有意义
可以看到,\int_step_variable:nnNn
需要的第三个参数需要接受一个 tl
类型 token,在循环的时候将每一次待循环的值赋给它, 他甚至不需要被定义.
在 LaTeX3 中有些变量是基于宏实现,还有一部分是基于寄存器实现,前者可以直接使用,后者则需要在前面加上 \xxx_use:
, 类似的在 TeX
中也有体现
\def\cmd{aaa}
\cmd % normally
\newcount\mycnt
\mycnt=1
\mycnt % error
\the\mycnt % normally
(2).
传入参数 #1
时 是指循环体内部的 {#1}
? 这里的 {}
可有可无.
(3).
个人感觉分场景吧, 如果你的循环在函数定义的内部, 那么循环体内部的 #
容易和函数定义中的 #
混淆, 因此循环体内部的 #
需要加倍, 如果嵌套比较深的情况下 ########1
这种东西一长串的虫子会比较恶心, 而使用 \int_step_variable
可以避免.
还是展开问题,tasks 环境内部以 \task
这个 token
作为分隔符, \task
本身并没有被定义, 所以当 tasks 环境读取的时候遇到
\seq_map_inline:Nn \l_fillin_count_seq
{
\task ##1
}
时, 它没有找到 \task
(注意这里的 \task
在 group 内部), 于是就会抛出警告, 且没有解析到 item
.
解决办法是先展开
\seq_map_inline:Nn \l_fillin_count_seq
{
\task ##1
}
为
\task xxx
\task xxx
\task xxxx
...
\documentclass{ctexart}
\usepackage{xcolor,tasks,xeCJKfntef}
\ExplSyntaxOn
\seq_new:N \l_fillin_count_seq
\NewDocumentCommand{\fillin}{+m}
{
\textcolor{red}{\CJKunderline{#1}}
\seq_gput_right:Nn \l_fillin_count_seq {#1}
}
\AtEndDocument{
\newcommand{\printanswers}{
\newpage
\section*{填空题答案}
\seq_map_inline:Nn \l_fillin_count_seq
{
\tl_put_right:Nn \l_tmpa_tl { \task ##1 }
}
\use:e
{
\exp_not:n { \begin{tasks}(4) }
\exp_not:V \l_tmpa_tl
\exp_not:n { \end{tasks} }
}
}
\printanswers
}
\ExplSyntaxOff
\begin{document}
这是1 \fillin{这是1}
这是2 \fillin{这是2}
这是3 \fillin{这是3}
这是4 \fillin{这是4}
这是5 \fillin{这是5}
\end{document}
你的 MWE 一点也不 M, 另外, 提问请采用 markdown 语法.
minipage 排版需要顶部对齐时,可尝试在每个 minipage 环境开始的地方加上一个 \null
.
\documentclass[aspectratio=169]{ctexbeamer}
\begin{document}
\begin{frame}{minipage 顶部对齐}
\begin{minipage}[t]{.3\textwidth}
\null
\centering
\includegraphics[width = .8\linewidth]{example-image-a}
\end{minipage}\hfill
\begin{minipage}[t]{.3\textwidth}
\null
\centering
\includegraphics[width = .5\linewidth]{example-image-a}
\end{minipage}\hfill
\begin{minipage}[t]{.3\textwidth}
\null
\centering
\includegraphics[width = .3\linewidth]{example-image-a}
\end{minipage}
\end{frame}
\end{document}
这是你想要的效果吗?
\documentclass[12pt]{ctexart}
\usepackage[most]{tcolorbox}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{pifont}
\newcounter{question}[section]
\newcounter{answer}[section]
\NewTColorBox{question}{}
{enhanced, fonttitle=\bfseries, title={\refstepcounter{question}\label{que:\thesection-\thequestion}Question~\thesection-\thequestion\hfill \ding{43}~\pageref{ans:\thesection-\thequestion}}}
\NewTColorBox{answer}{}
{enhanced, fonttitle=\bfseries, title={\refstepcounter{answer}\label{ans:\thesection-\theanswer}Answer~\thesection-\theanswer\hfill \ding{49}~\pageref{que:\thesection-\theanswer}}}
\begin{document}
\section{这是第一章节}
\begin{question}
\[
a^2 + b^2 = c^2
\]
\end{question}
\lipsum[1-10]
\begin{answer}
\[
a^2 + b^2 = c^2
\]
\end{answer}
\end{document}
1.
\hbox_set:Nn \l_indent_box {\noindent 这是缩进}
中的 \noindent
是不必要的.
2.
\NewDocumentEnvironment{hindent}{+m}
你需要 m
型参数, 但是你下面环境却没有给参数, 我猜测你想要的是 +b
.
3.
\coffin_join:NnnNnnnn \l_indent_coffin {t} {r} \l_text_coffin{t}{l}
需要 8 个参数, 但是你只给了 6 个.
你可以使用行内盒子
\documentclass[10pt]{article}
\usepackage{tcolorbox}
\usepackage{lipsum}
\newtcbox{\mybox}{colback=red!5!white,
colframe=red!75!black}
\begin{document}
\lipsum[1]
\mybox{This is my own box.}
\lipsum[1]
\end{document}
你可以使用 \mathop
\[
\mathop{\arg\max}\limits_{x \in S}
\]
你也可以使用 `
你的 MWE 在我电脑上是正常的,我的环境为 texlive2023
+ xelatex
.
可以使用 graphbox
包提供的 align = t
选项.
此外, 使用 \parbox
或者 minipage
的 t
选项时, 建议在最顶部加上一个 \null
.
\noindent\parbox[t][0.3\textwidth][t]{\textwidth}{
\parbox[t][0.3\textwidth][t]{0.3\textwidth}
{\null\includegraphics[width=0.3\textwidth, align = t]{example-image-1x1.pdf}}
\parbox[t]{0.65\textwidth}{\null\Large
456\\789
}
}
完整代码:
\documentclass[draft,
a4paper,zihao=-4,
twoside,openany]{ctexart}
\usepackage{graphicx}
\usepackage{mwe}
\usepackage{graphbox}
\usepackage{calc}
\begin{document}
\noindent\parbox[t][0.3\textwidth][t]{\textwidth}{
\parbox[t][0.3\textwidth][t]{0.3\textwidth}
{\null\includegraphics[width=0.3\textwidth, align = t]{example-image-1x1.pdf}}
\parbox[t]{0.65\textwidth}{\null\Large
456\\789
}
}
\end{document}
没什么大问题,少了个 at
.
% \node [fill=red,inner sep=1pt,label={below:$H$},circle] (H) {};
\node [fill=red,inner sep=1pt,label={below:$H$},circle] at (H) {};
使用一个宏包之前请认真阅读一下宏包手册.
tkzelements
环境内是 lua
代码, 所以注释符应该使用 lua
的注释符 --
.
实际上在宏包手册中也有很多注释, 只是你从来没有认真看过.
试试 \string
\newwrite\out
\immediate\openout\out=out.tex
\immediate\write\out{%
\string\pageref{myref:\mynum}
}
\immediate\closeout\out
得到
\pageref{myref:1}
\newlength{\leftmarkwidth}
\renewcommand{\headrule}{%
\settowidth{\leftmarkwidth}{\leftmark}%
\vspace*{-.5\baselineskip}%
\vrule width \leftmarkwidth height .5pt\relax%
}
\documentclass[12pt]{ctexart}
\usepackage{amsmath}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{lipsum}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\thepage}{\roman{page}}
\newlength{\leftmarkwidth}
\renewcommand{\headrule}{%
\settowidth{\leftmarkwidth}{\leftmark}%
\vspace*{-.5\baselineskip}%
\vrule width \leftmarkwidth height .5pt\relax%
}
\fancyhead[L]{\leftmark}
\fancyfoot[C]{第 \thepage 页,共 \pageref{LastPage} 页}
\begin{document}
\section{如何入门\LaTeX{}}
\lipsum[2-6]
\section{如何进一步学习\LaTeX{}Long Long Long Long Long Long}
\lipsum[2-6]
\section{如何系统性学习\LaTeX{}}
\lipsum[2-6]
\section{如何入坑\LaTeX{}}
\lipsum[2-6]
\section{如何放弃\LaTeX{}Long Long Long Long}
\lipsum[2-6]
\end{document}
ctexart
修改了默认行距, 所以才会出现这个问题,可以尝试修改行距
\documentclass[12pt]{ctexart}
\usepackage{amsmath}
\usepackage{longdivision}
\linespread{1}\selectfont
\begin{document}
\[
\longdivision{1024}{8}
\quad
\longdivision[4]{114514}{233}
\quad
\longdivision[2]{666.666}{88}
\quad
\longdivision[repeating decimal style = dots ]{5.3}{37}
\]
\end{document}
问 关于\int_set赋值的问题