Sagittarius Rover
Sagittarius Rover
我要成为Typst糕手/(ㄒoㄒ)/~~

注册于 2年前

回答
274
文章
0
关注者
11

使用Koodo Reader发现确实有这种现象

image.png

通过ctex文档可见beforeskipafterskipsection时为弹性长度(glue),同时ctex还有fixskip的行为.

image.png

image.png

我想雾月老师的前一个回答也许是这个意思:

\documentclass[12pt,fontset=ubuntu]{ctexbook}
\usepackage[showframe]{geometry}
\usepackage{zhlipsum}
\pagestyle{plain}
\ctexset{
    section/beforeskip = 3.5ex,
    section/afterskip = 2.3ex,
    chapter/fixskip = true,
    section/fixskip = true,
}
\renewcommand{\baselinestretch}{1.3}

\begin{document}
  \tableofcontents

  \chapter{章标题}
  \section{节标题}
  很短的正文内容

  \chapter{章标题}
  \section{节标题}
  \zhlipsum
  \zhlipsum
\end{document}

image.png

Welcome to LaTeX studio!
但是你的上面提供的代码有一些问题:

  • 代码没有用围栏式代码框包围起来,这样会损失很多的\符号。建议学会之后使用“补充问题”功能重新调整你上面的代码...
  • 代码图片没有给出,这样我需要一个个手动替换
  • 代码不完整,提问的代码应该包含你的导言区的有关信息
  • “每行中插入的图片与顶部hline平齐,怎样使图片可以居中”此句缺少图示,不一定能令人很好的理解

Anyway,我想下面的链接和例子可以解决你的问题。

\documentclass[fontset=ubuntu,landscape]{ctexart}
\usepackage{geometry}
\usepackage{array}
\usepackage{graphbox}
\begin{document}
    \begin{table}[h]
        \centering
        \caption{这是12个特征信息}
        \label{tab:features}
        \begin{tabular}{*{5}{p{2.5cm}<{\centering}}}
        \hline
        特征名称 & Metal & Thicken & Scarepair & Locpoint \\
        \hline
        特征图像 & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} \\
        \hline
        特征名称 & Flowerlinks & Abgirthweld & Abspiralweld &Vent \\
        \hline
        特征图像 & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} \\
        \hline
        \end{tabular}
    \end{table}
\end{document}

image.png


在你这个已有的代码框架下我暂时没什么更好的办法,用了一点不得体之术,如下:
区别在于用\phantom加上两行文字占了位:

\parbox{\linewidth}{\phantom{txt}\\\includegraphics[width=\linewidth,align=c,height=2cm]{example-image}\\\phantom{txt}}
\documentclass[fontset=ubuntu,landscape]{ctexart}
\usepackage{geometry}
\usepackage{array}
\usepackage{graphbox}
\begin{document}
    \begin{table}[h]
        \centering
        \caption{这是12个特征信息}
        \label{tab:features}
        \begin{tabular}{*{5}{p{2.5cm}<{\centering}}}
        \hline
        特征名称 & Metal & Thicken & Scarepair & Locpoint \\
        \hline
        特征图像 & \parbox{\linewidth}{\phantom{txt}\\\includegraphics[width=\linewidth,align=c,height=2cm]{example-image}\\\phantom{txt}} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c,height=2cm]{example-image} \\
        \hline
        特征名称 & Flowerlinks & Abgirthweld & Abspiralweld &Vent \\
        \hline
        特征图像 & \parbox{\linewidth}{\phantom{txt}\\\includegraphics[width=\linewidth,align=c,height=2cm]{example-image}\\\phantom{txt}}  & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} & \includegraphics[width=\linewidth,align=c, height=2cm]{example-image} \\
        \hline
        \end{tabular}
    \end{table}
\end{document}

image.png

更简易参考上面TSE链接的方法试试好评如潮tabularray宏包,

Happy LaTeXing!

不同的算法实现宏包的syntax有些许差异,建议参考这个链接

浅浅修改了一下:

\documentclass{article}
\usepackage{algorithm,algpseudocode,float}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{hyperref}
\makeatletter
\newenvironment{breakablealgorithm}
  {% \begin{breakablealgorithm}
   \begin{center}
     \refstepcounter{algorithm}% New algorithm
     \hrule height.8pt depth0pt \kern2pt% \@fs@pre for \@fs@ruled
     \renewcommand{\caption}[2][\relax]{% Make a new \caption
       {\raggedright\textbf{\ALG@name~\thealgorithm} ##2\par}%
       \ifx\relax##1\relax % #1 is \relax
         \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##2}%
       \else % #1 is not \relax
         \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##1}%
       \fi
       \kern2pt\hrule\kern2pt
     }
  }{% \end{breakablealgorithm}
     \kern2pt\hrule\relax% \@fs@post for \@fs@ruled
   \end{center}
  }
\makeatother

\begin{document}

\section{Some section}

\lipsum[1]

\begin{breakablealgorithm}
    \caption{Modeling ......}
    \label{alg:modeling}
    \begin{algorithmic}[1]
    \State Read the data file: 'Lorem Ipsum'
    \State I can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    \[
    \text{Lorem Ipsum:} \quad x A (1 - \frac{1}{1}) - \alpha \cdot \text{Glass} \cdot A
    \]
    where:
    \[
\text{Lorem Ipsum:} \quad x A (1 - \frac{1}{1}) - \alpha \cdot \text{Glass} \cdot A
\]
    \State I can eat glass, it does not hurt meI can eat glass, it does not hurt meI can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt meI can eat glass, it does not hurt meI can eat glass, it does not hurt me
    \State I can eat glass, it does not hurt me
    
    \[
\text{Lorem Ipsum:} \quad x A (1 - \frac{1}{1}) - \alpha \cdot \text{Glass} \cdot A
\]
    \State I can eat glass, it does not hurt meI can eat glass, it does not hurt meI can eat glass, it does not hurt me
    \State Output ...........
    \State As dawn broke over the horizon:
    \State \quad The adventurers gathered their supplies — maps, lanterns, and charms.
    \State \quad Each carried a secret token (a silver coin, a feather, and a stone).
    \State \quad The forest stretched endlessly, veiled in morning mist.
    \State \quad Time felt frozen, yet fleeting.
    \State Their guide, an old sage:
    \State \quad Spoke of paths less traveled and shadows that whispered.
    \State \quad Warned of the river crossing at twilight.
    \State \quad And the moonlit grove where choices would bind their fate.
    \State With resolve, they stepped onto the mossy trail:
    \State \quad Their steps matched an unspoken rhythm.
    \State \quad Echoes of distant bells resonated in the air.
    \State A sudden breeze carried faint laughter:
    \State \quad Was it the forest itself or something hidden within?
    \State \quad The youngest adventurer clutched their charm tightly.
    \For{every mile deeper into the woods}
    \State Shadows grew longer and whispers louder.
    \State A riddle carved into an ancient oak appeared:
    \[ \textit{"To find the light, embrace the dark; to move ahead, step apart."} \]
    \State They chose their steps carefully, navigating roots and stones:
    \[ \textit{"One misstep could wake the slumbering earth."} \]
    \State Night fell as the group reached the silver brook:
    \[ \textit{"Here lies the mirror of truth and deceit."} \]
    \State They paused, letting the silence settle before crossing.
    \EndFor
    \State As dawn approached once again: The forest opened to a clearing bathed in gold.
    \State Their journey, though incomplete, had reshaped them forever.
\end{algorithmic}
\end{breakablealgorithm}

I can cite it \ref{alg:modeling} here.

\end{document}

image.png

注意!!!代码块的符号是反引号`,不是左引号'

请善用“补充问题”和“预览”功能,为了论坛其他用户的良好观感

请勿必修改原问题的代码块标识符!

下面应该不是一个好的practice...抛砖引玉吧...

可以试试把他们放到两个scope内...


\documentclass[border=8pt,tikz]{standalone}
\usepackage{tkz-euclide}
\begin{document}
   \begin{tikzpicture}[scale=2,line join=round,line cap=round]
    \tikzmath{\r=.02;}
    \begin{scope}[
        x={(-.4cm,-.4cm)},
        y={(1cm,0cm)},
        z={(0cm,1cm)},
    ]
        \coordinate[label=45:$D$](D)at(0,0,0);
        \coordinate[label=below:$A$](A)at(1,0,0);
        \coordinate[label=right:$C$](C)at(0,1,0);
        \coordinate[label=below:$B$](B)at(1,1,0);
        \coordinate[label=left:$A_1$](A1)at(1,0,1);
        \coordinate[label=right:$C_1$](C1)at(0,1,1);
        \coordinate[label=above:$B_1$](B1)at(1,1,1);
        \coordinate[label=above:$D_1$](D1)at(0,0,1);
        \coordinate[label=left:$E$](E)at($(D)!.5!(A)$);
        \coordinate[label=right:$F$](F)at($(B)!.5!(C)$);
        \draw(A1)--(B1)--(C1)--(D1)--cycle (A1)--(B1)--(B)--(A)--cycle (B1)--(C1)--(C)--(B)--cycle;
        \draw[dashed](D1)--(D)--(A) (C)--(D);
        \draw[cyan,dashed] (A1)--(E)--(F)--cycle ;
        \draw[cyan](B1)--(F);
        \draw[red,dashed](A1)--(C);
    \end{scope}
        % a bit ugly code here...
        \filldraw[cyan](.5,.5,.51)circle(\r) node[above] {$O$};
    \end{tikzpicture}
\end{document}

image.png

texdoc nicematrix

请根据上面命令呼出的文档自行补充...

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{nicematrix}
\begin{document}
\[
    \begin{bNiceArray}{*6c*6c}[columns-width=2mm,margin]
        \Block[borders={bottom,right,tikz=dashed}]{6-6}<\LARGE>{\mathbf{E}_{6m}}&&& & & &\Block[borders={bottom,right,tikz=dashed}]{2-4}<\Large>{\mathbf{O}} & & & & \Block[borders={bottom,tikz=dashed}]{2-2}<\Large>{\mathbf{E}_{2m}}& \\
        & &&&& & & & & & & \\
        & &&&& &\Block[borders={bottom,right,tikz=dashed}]{4-4}<\Large>{\mathbf{E}_{4m}} & & & &\Block[borders={bottom,tikz=dashed}]{4-2}<\Large>{\mathbf{O}} & \\
        & &&&& & & & & & & \\
        & &&&& & & & & & & \\
        & &&&& & & & & & & \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
        1&2 &3&4 &5&6 &7 &8 &9 &10 &11 &12 \\
    \end{bNiceArray}
\]
\end{document}

image.png

同时强烈建议掌握围栏代码块语法。

谢谢雾月老师的解释,但我还有几个小问题:

  1. 是否有简单的方法确定\node读取键时“真正”的展开情况
  2. 我之前一直以为这两者的差异是colorinner sep这两个key的性质不同导致的;而经过进一步测试发现上述例子是因为读取key时,对于那些允许省略键的选项不会出错,而不允许省略键的选项则会因为展开顺序的问题而报错;是什么造成了这一区别呢?
  3. unexpended命令和noexpand/\exp_not:n是否有区别(?)我通过latexdef发现后两者等价,而unexpendednoexpand均为Plain-TeX的原语。

根据报错信息猜测是编组被\newenvironment拆后和\fbox的定义出现了{}的错配,提供一种曲线救国(不优雅)的方案。

\documentclass[11pt,fontset=ubuntu]{ctexart}
\usepackage[margin=1in]{geometry}
\usepackage{zhlipsum}
\newcommand{\createenv}[1]{%
    \begin{center}% 开始居中环境
        \fbox{%
            \begin{minipage}{0.9\textwidth}
                {\small\itshape {#1}}
            \end{minipage}
        }%
    \end{center} % 
}
\NewDocumentEnvironment{mynote}{+b}{%
    \begingroup%
    \createenv{#1}%
}{\endgroup}%

\begin{document}

\begin{mynote}%
   \zhlipsum[1]
\end{mynote}%

\section{A Section}

\begin{center}%
    \fbox{%
        \begin{minipage}{0.9\textwidth}
            \small\itshape
            \zhlipsum[2]
        \end{minipage}
    }%
\end{center}%

\end{document}

另外,你的最小工作示例中还有很多和本问题无关的宏包;同时article文档类有且只有10pt(default),11pt,12pt这三个选项,你选择的10.5pt实际上为默认值10pt.

off-topic...只是好奇,在新华字典中“鉏”字并没有简化写法,为什么可以确定 你所造的字体与原字体是等价的?

image.png

提问需要注意以下几点:

  1. 代码务必使用围栏代码块包裹以实现高亮,不然让人怎么复制??
  2. 上传文件请务必等其上传到服务器之后再点击提交,对于包含大量文件的MWE,请将其压缩为.zip格式,并且图示具体说明你想调的是哪部分字体

image.png

3.提问要逻辑清晰指代准确。“一开始会报错,要把这个tex文件和发的东西放一起”是想表达什么(?)
4.本论坛有"修改问题"和"预览问题"的功能,这都是你要用的

image.png

image.png

5.一个优秀的tag,应该是能准确的描述和概括该问题的,我严重怀疑zitie是你乱打的...

P.S.你是否看过lshort-zh-cn的这部分内容(?)

image.png

此外,想要修改模板,请你指出相应的规范要求,应该严格按照规范要求来进行你的排版。在模板使用中,你觉得“这个字体太小”等想法是不严谨的,模板制作者一定按照的是美赛的规范来编写的模板。

为什么不看lshort-zh-cn?

image.png


A practice is here:
https://tex.stackexchange.com/questions/678477/documentclass14ptextarticle-i-cannot-have-more-that-14pt

总的来说,你可以通过如下设置随意调整尺寸

\RequirePackage{fix-cm}
\usepackage[fontsize=14pt]{fontsize}

但可能导致一些不良后果,但这是模板实现方式的问题,例如:
image.png

不禁又要问:为什么你一定要调整字体大小呢?是有什么规范让你必须(MUST)这么做吗?如果没有,不建议修改。

另附:压缩包密码为 zstar !!!!!

@u134436 关于填空题,可以使用\parbox内嵌于\phantom

\documentclass[fontset=ubuntu]{ctexart}
\usepackage{xeCJKfntef}
\usepackage[a4paper]{geometry}
\usepackage{xcolor}
\usepackage{tagging}
\usepackage{zhlipsum}
% \usetag{ans}% 注释掉该行语句不显示答案
\newcommand{\answer}[1]{
    \par\vspace*{.5ex}
    \iftagged{ans}{\parbox[s]{.94\textwidth}{#1}}{\phantom{\parbox[s]{.94\textwidth}{#1}}}
    \par\vspace*{.5ex}
}

\begin{document}
\begin{enumerate}
\item 这是第一题的题干第一题的题干第一题的题干第一题的题干第一题的题干
\answer{这是答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案圆是到定点的距离等于定长的点的集合.}

\item 这是第二题的题干这是第二题的题干这是第二题的题干这是第二题的题干这是第二题的题干
\answer{答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案答案圆是到定点的距离等于定长的点的集合到定点的距离等于定长的点的集合到定点的距离等于定长的点的集合.}

\item 这是第三题的题干题干题干这是第三题的题干题干题干这是第三题的题干题干题干这是第三题的题干题干题干这是第三题的题干题干题干
\answer{答案答案答案答案答案答案答案答案答案答案答案答案是到定点的距离等于定长的点的集合到定点的距离等于定长的点的集合.}

\end{enumerate}

\end{document}

image.png

Thanks to deepseek(AI论坛秀了属于是),我在他给的答案基础上修改了一下,应该可以满足需求:

\documentclass[fontset=ubuntu]{ctexart}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum,zhlipsum}
\usepackage{atbegshi}
\newif\ifinsertblankpage
\insertblankpagefalse

\let\oldabstract\abstract
\let\endoldabstract\endabstract
% 定义英文摘要环境
\newenvironment{enabstract}{%
  \renewcommand\abstractname{Abstract}
  \oldabstract
}{%
  \endoldabstract \newpage
}
% 定义中文摘要环境,并启用插入空白页
\newenvironment{cnabstract}{%
  \renewcommand\abstractname{摘要}
  \insertblankpagetrue % 启用插入空白页
  \oldabstract
}{%
  \endoldabstract \newpage
  \insertblankpagefalse % 关闭插入空白页
}
% 页面输出钩子:在中文摘要的每一页后插入空白页
\AtBeginShipout{%
  \ifinsertblankpage
    \AtBeginShipoutOriginalShipout\box\AtBeginShipoutBox % 输出当前页
    \AtBeginShipoutOriginalShipout\null % 输出空白页
  \fi
}

\begin{document}

% 中文摘要部分:每一页后自动插入空白页
\begin{cnabstract}
\zhlipsum[1-8] % 生成多页中文摘要
\end{cnabstract}

% 英文摘要及其往后部分:正常双面打印
\begin{enabstract}
\lipsum[1-12] % 生成多页英文摘要
\end{enabstract}

\end{document}

上述代码的效果是:
image.png

不过上面的代码会报一个警告:

LaTeX: Ignoring void shipout box.
               The shipout box was voided by hook code.

应该是\AtBeginShipoutOriginalShipout\null导致的,不过你原问题中atbegshi宏包作者Heiko Oberdiek都用了类似的实现,想来不是什么问题。

上面代码报错的原因是缺少int(\i+45)

\documentclass[tikz,border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
    \draw (0,0) circle(2);
    \foreach \i in {0,45,...,315}{
        \coordinate (A\i) at (\i:2); % 定义点的位置
        \draw[fill] (A\i) circle (2pt); % 画点
    }
    \foreach \i in {0,45,...,315} {
        \pgfmathsetmacro{\next}{int(\i+45)}
        \ifnum \next=360\relax 
            \pgfmathsetmacro{\next}{0} 
        \fi
        \draw[->] (A\i) -- (A\next); 
    }
\end{tikzpicture}
\end{document}

image.png

我很想知道这种图的来源,包括它的所在学科,英文名称以及大致含义。

同时你这个图可拓展性较差,下面的实现也很不优雅,我没有兴趣封装成接口。

另外为了论坛问题的neat,请你删除这一无效问题,想要修改问题可以使用补充问题功能,而不是重新开一个新的问题。

image.png

下面是en画的实现过程...

\documentclass[tikz,border=8pt]{standalone}
\usetikzlibrary{arrows.meta,decorations.markings}
\begin{document}
\begin{tikzpicture}[cap = round]
    % \draw (0,0) circle(2);
    \foreach \i in {30,60,...,150,240,270,300}{
        \node[circle,draw,inner sep=1pt,outer sep=0pt,minimum size=2pt] (A\i) at (\i:2) {}; % 画点
    }
    \foreach \i in {30,60,...,120,240,270} {
        \pgfmathsetmacro{\next}{int(\i+30)}
        \path[->] (A\i) edge[bend right=8] (A\next);
    }
    \foreach \angle/\txt in {30/2,60/1,90/0,120/n-1,150/n-2}{
        \node[label={[anchor=\angle+180,outer sep=1pt,inner sep=1.5pt,]\scriptsize$\txt$}] at (\angle:2) {};
    }
    \foreach \i in {180,210,330,0}{
        \node[circle,inner sep=0pt,outer sep=0pt,minimum size=0pt] (A\i) at (\i:2) {}; % 画点
    }
    \foreach \i in {150,210,300,0} {
        \pgfmathsetmacro{\next}{int(\i+30)}
        \ifnum \next=360 \pgfmathsetmacro{\next}{0} \fi
        \path[->] (A\i) edge[bend right=10] (A\next);
    }
    \path[dotted] (A180) edge[bend right=10] (A210) 
                  (A330) edge[bend right=10] (A0);
\end{tikzpicture}
\end{document}

image.png

其实要想优雅一点,可以用rotate把整个路径划分为:

  • 上半段node
  • 左侧无node虚线段
  • 下半段node
  • 左侧无node虚线段

不过个人觉得意义不是很大。

请你详细准确地表述你的需求和预期效果

如果你只想把长条状的Logo放在首页的左上角,你可以如下做:

\documentclass{beamer}
\usepackage[UTF8,noindent]{ctexcap}
\usepackage{tikz}
\usepackage{graphicx}
\usetheme{AnnArbor}
\usecolortheme{crane}
\institute[NJUPT]{南京邮电大学}
\author[Robert$\cdot$Charlie]{贺XX}
\title[Beamer模板]{这是文档的大标题}
\date{\today}
\subtitle{这是文档的小标题}
\subject{模板}
% 自定义 logo 的位置
% 在左上角添加校徽
% 设置背景图位置 这里的xshift和yshift可以调节相对位置
\setbeamertemplate{background}{%
    \begin{tikzpicture}[overlay, remember picture]
    \node[xshift=3em,yshift=-3.3em] at (current page.north west) {\includegraphics[height=.15\paperheight]{NJUPT.png}};
\end{tikzpicture}
}
\begin{document}
\maketitle
\setbeamertemplate{background}{} %还原背景图层
% 不过我觉得更优雅的办法是写入\maketitle里代码会更好一点
    \begin{frame}{目录}
        \tableofcontents
    \end{frame}
    \section{这是第一部分}
    \begin{frame}{第一节标题}{第一节小标题}
        内容...
    \end{frame}
\end{document}

效果如下:

image.png


补充,你想要实现类似HDUbeamer的效果@u79794 我显然没有手搓一个模板的水平,只能在用户层简单地实现如下的效果:

\documentclass{beamer}
\usepackage[UTF8,noindent]{ctexcap}
\usepackage{tikz}
\usepackage{graphicx}
\usetheme{AnnArbor}
\usecolortheme{crane}
\institute[NJUPT]{南京邮电大学}
\author[Robert$\cdot$Charlie]{贺XX}
\title[Beamer模板]{这是文档的大标题}
\date{\today}
\subtitle{这是文档的小标题}
\subject{模板}
% 设置背景图位置 这里的xshift和yshift可以调节相对位置
\setbeamertemplate{logo}{%
\begin{tikzpicture}[overlay, remember picture]
    \node[xshift=15em,yshift=-9em] at (current page.north west) {\includegraphics[height=.1\paperheight]{long-logo.jpg}};
\end{tikzpicture}
}
\begin{document}
    \maketitle
    \setbeamertemplate{logo}{} %重置logo效果
    \setbeamertemplate{background}{
        \begin{tikzpicture}[overlay, remember picture]
            \node[xshift=-1em,yshift=-1em,opacity=.3] at (current page.east) {\includegraphics[height=.7\paperheight]{NJUPT.png}};
        \end{tikzpicture}
    }
    \begin{frame}{目录}
        \tableofcontents
    \end{frame}
    \section{这是第一部分}
    \begin{frame}{第一节标题}{第一节小标题}
        内容...
    \end{frame}
\end{document}

注意上面的代码需要保证long-long.jpgNJUPT.png的路径,效果如下:
image.png

BTW,既然你想实现HDUbeamer的效果,我建议你站在S老师巨人的肩膀上,修改HDUbeamer.cls会更好,最好不要重复造轮子。

Happy LaTeXing, and welcome to the LaTeX studio!

我想这是你想要的...其实没必要在tcb外面封装成amsthm(这让代码变得很不优雅,既然amsthm要套tcb),tcb本身也支持计数器的使用,著名的elegantbook模板的fancy样式对定理环境的实现也只是纯tcolorbox。我同时还把mwe更精简了一丢丢...

P.S. xparse已经进入latex kernel,因此不需显式调用。你可以texdoc xparse看看参数,lshort-zh-cn其实有简单的介绍,所谓的\NewTColorBox也不过是tcb版本的newenvironment而已。

image.png

\documentclass[10pt]{ctexbook}
\usepackage[margin=1in,showframe]{geometry}
\usepackage[most]{tcolorbox}
\usepackage{varwidth}
\usepackage{amsmath}
\usepackage{enumitem}
\setlist[enumerate]{leftmargin=1em}
\definecolor{mygreen}{RGB}{0,166,82}
\NewTColorBox[auto counter,number within=section]{theobox}{O{}}{% o省略可能的参数
  enhanced,frame empty,interior empty,
  coltitle=white,fonttitle=\bfseries,
  colbacktitle=mygreen,rounded corners,
  extras broken={frame empty,interior empty},
  borderline={0.25mm}{0mm}{mygreen},
  breakable,top=4mm,before skip=3.5mm,
  attach boxed title to top left={yshift=-3mm,xshift=5mm},boxed title style={boxrule=0pt,sharp corners=all},varwidth boxed title,
  title={考点\thetcbcounter\quad{#1}},
}
\newcommand*{\insertxt}{%
  \begin{enumerate}
    \item 素质教育以提高国民素质为根本宗旨。
    \item 素质教育是面向全体学生的教育。
    \item 素质教育是促进学生全面地、生动活泼地、可持续地发展的教育。
    \item 素质教育是促进学生个性发展的教育。
    \item 素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。素质教育要着力提高学生的社会责任感、创新精神和实践能力。
  \end{enumerate}
}
\begin{document}
\chapter{你好}
\section{世界}
\begin{theobox}
  \insertxt
\end{theobox}
\begin{theobox}[有标题]
  \insertxt
\end{theobox}
\section{世界}
\begin{theobox}[有标题盒子]
  \insertxt
\end{theobox}
\begin{theobox}
  \insertxt
\end{theobox}
\chapter{你好}
\section{世界}
\begin{theobox}[有标题盒子]
  \insertxt
\end{theobox}
\begin{theobox}
  \insertxt
\end{theobox}
\begin{theobox}[有标题盒子]
  \insertxt
\end{theobox}
\begin{theobox}
  \insertxt
\end{theobox}
\end{document}

image.png

在使用宏包前务必仔细阅读文档!!!通过在命令执行texdoc physics命令可以看到:

image.png

\documentclass[11pt,a4paper]{ctexbook}
\setlength{\parindent}{0pt}
\let\olddiv\div
\usepackage{physics}
\begin{document}
    physics包影响div除法:

    $2=6\div 3$

    $2=6\olddiv 3$

    $2=6\divisionsymbol 3$

\end{document}

image.png

P.S.有类似需求的话也可以看看ZTX老师的physics2宏包,更符合中国宝宝体质。

image.png

发布
问题