芒果不盲
芒果不盲
学好TiKZ和tcolorbox!

注册于 3年前

回答
51
文章
1
关注者
2

请提供MWE, 我这边没有问题

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\section{$\bar{s},\underline{aa}$}
\subsection{$r_1>\bar{\mu}_1$and$r_2<\underline{\mu}_2$}
\subsection{The worst case prior in $[\underline{\mu}, \bar{\mu}] \times[\underline{\sigma}, \bar{\sigma}]$}
\end{document}

texlive2023 + PDFLaTeX

tikz实现

\documentclass[margin=1cm]{standalone}
\usepackage{tikz,ctex}

\begin{document}

\begin{tikzpicture}[x = 1cm,y = .5cm]
    \tikzset{circle/.pic = {
        \draw[] (0,0)circle (2pt);
    },
    triangle/.pic = {
        \draw[] (90:2pt) -- (210:2pt) -- (-30:2pt) -- cycle;
    }
    }


    \foreach \y[count = \x] in {
        0.9, 0.9, 1.5, 2.1,
        2.1, 2.5, 2.7, 2.5,
        2.8, 2.1, 1.6, 1.8
    }{
        \coordinate (m-\x) at (\x,\y);
        \pic at (\x,\y) {circle};
        \node[above = 2pt, scale = .75] at (\x,\y) {\y};
    }


    \foreach \y[count = \x] in {
        0.4, 0.6, 0.0, 0.4,
       -0.2, 0.0, 0.5,-0.1,
        0.3, 0.1,-0.2, 0.0
    }{
        \coordinate (n-\x) at (\x,\y);
        \pic at (\x,\y) {triangle};
        \node[below = 2pt, scale = .75] at (\x,\y) {\y};
    }

    \foreach \x[evaluate=\x as \y using \x+1] in {1,2,...,11} {
        \draw[] (m-\x) -- (m-\y);
        \draw[] (n-\x) -- (n-\y);
    }

    \draw[] (0.5,-3) rectangle (12.5,6);

    \foreach \x[count = \xc] in {{1月},{2月},{3月},{4月},{5月},{6月},{7月},{8月},{9月},{10月},{11月},{12月}} {
        \node[below,scale = .75] at (\xc, -3) {\x};
        \draw[] (\xc + .5,-3) --++ (0,.2);
    }

    \foreach \y in {-3.0,0.0,3.0,6.0} {
        \draw[] (0.5,\y)node[left, scale = .75]{\y} --++ (.1,0);
    }

    \node[scale = .75] at (6.5,6.5) {2022年居民消费价格月度涨跌幅度};

    \node[scale = .75] at (0.5,6.5) {\%};

    \node[anchor = north west] at (0.5,6.0) {
        \tikz {
            \draw[] (0,0) -- (1,0);
            \pic at (.5,0) {circle};
            \node[anchor = west, scale = .75] at (1.1,0) {月度同比};
            \draw[] (2.5,0) -- (3.5,0);
            \pic at (3,0) {circle};
            \node[anchor = west, scale = .75] at (3.6,0) {月度环比};
        }
    };
\end{tikzpicture}
\end{document}

你可以使用

\def\sab#1{%
\expandafter\ifcase\csname c@#1\endcsname%
  \or 甲%
  \or 乙%
  \or 丙%
  \or 丁%
  \or 戊%
  \or 己%
  \or 庚%
  \or 辛%
  \or 壬%
  \or 癸%
\fi%
}

定义一种计数器(\sab) Stems-and-Branches(天干地支), 然后修改 \thefigure

\def\thefigure{\sab{figure}}

源码如下:

\documentclass{ctexart}
\usepackage{caption}
% Stems-and-Branches

\def\sab#1{%
\expandafter\ifcase\csname c@#1\endcsname%
  \or 甲\or 乙\or 丙\or 丁\or 戊\or 己\or 庚\or 辛\or 壬\or 癸
\fi%
}
\def\thefigure{\sab{figure}}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[width = 5cm]{example-image}
    \caption{this is a picture.}\label{fig:a}
\end{figure}
\begin{center}
    \includegraphics[width = 5cm]{example-image-a}
    \captionof{figure}{this is a fig.}\label{fig:b}
\end{center}

\verb|hahahhahahha and this is \ref{fig:a} and \ref{fig:b}| $==>$

hahahhahahha and this is \ref{fig:a} and \ref{fig:b}
\end{document}

image.png


  • 下次提问希望能够尽可能提供最小工作示例
  • 楼上用了 LaTeX3 我就用 TeX 吧(

如果待使用的文件在同一文件夹内,命名无规则且文件数量多,可以参考下
用LaTeX3通过遍历插入指定目录中的所有图像

% 使用LaTeX3遍历图像目录中的图像并实现插图
\documentclass{ctexart}

% 需要的宏包
\usepackage{expl3}
\usepackage{xparse}
\usepackage{graphicx}
\usepackage{zhlipsum}

% 开启LaTeX3环境
\ExplSyntaxOn

% 插图标签处理函数
\cs_new_protected:Nn \fig_label:N
{
  #1 % 可以是\label 或 \ref
  {
    fig \c_colon_str
    % 整数转换为小写罗马数字
    \int_to_roman:n {\l_cnt_int}
  }
}
% 声明计数整数变量,并赋初值为1
\int_new:N \l_cnt_int
\int_set:Nn \l_cnt_int {1}
% 声明文件名列表变量
\tl_new:N \l_figs_tl
% 创建clist
\clist_new:N \l_figs_clist
% 定义排版命令,默认排版当前目录下figs目录下的图像
\NewDocumentCommand{\figslist} {O{figs}}
{
  % 调用命令“ls -m #1/*”命令列出当前指定目录下的文件,并保存在\l_figs_tl中
  \sys_get_shell:nnN {ls~-m~#1/*}{}\l_figs_tl
  % 设置clist
  \clist_set:NV \l_figs_clist \l_figs_tl
  % 遍历clist并实现插图及label和ref引用
  \clist_map_inline:Nn \l_figs_clist
  {
    \zhlipsum[1]\par
    如``图\fig_label:N \ref''所示\par
    \begin{figure}[!htb]
      \centering
      \includegraphics[width=0.35\textwidth]{##1}
      \caption{##1}
      \fig_label:N \label
    \end{figure}
    \int_incr:N \l_cnt_int
  }
}

\ExplSyntaxOff

\begin{document}
  \figslist

  \figslist[pics]
\end{document}

\documentclass{article}

\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts,amssymb}
\usepackage{amsthm}

\begin{document}
aaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
\begin{flalign}
    &\left\{    
    \begin{aligned}
        x&=eq1\\
        y&=eq2+1
    \end{aligned}
    \right.&
\end{flalign}
\end{document}

  • 为了 l3keysl3keys 是不必要的
\documentclass{article}
\ExplSyntaxOn
  \NewDocumentCommand\mytest{m}{
    \clist_map_inline:nn{A,B,C,D}{
      \exp_args:Nx\tl_if_in:nnT{\text_uppercase:n{#1}}{##1}{##1}
    }
  }
\ExplSyntaxOff
\begin{document}
\mytest{A}\par 
\mytest{B}\par 
\mytest{C,A}\par
\mytest{abc}\par 
\mytest{cABd}
\end{document}

QQ截图20221110151900.png

第一个问题请看 lshort-zh-cn
第二个问题,如果只是单纯做这个效果,没必要分栏,minipage 即可

\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{geometry}
\geometry{top=25mm,bottom=25mm,left=25mm,right=25mm,marginparwidth=20mm,marginparsep=5mm}
\begin{document}

\begin{minipage}{0.5\textwidth}
{\small
\[
    \text{分类标准}
    \begin{cases}
        \text{保险经营}
        \begin{cases}
            \text{保险经营主体}
            \begin{cases}
                \text{公营保险}
                \\
                \text{民营保险}
            \end{cases}
            \\
            \text{保险经营性质}
            \begin{cases}
                \text{营利保险}
                \\
                \text{非营利保险}
            \end{cases}
        \end{cases}
        \\
        \text{保险技术}
        \begin{cases}
            \text{计算技术}
            \begin{cases}
                \text{人寿保险}
                \\
                \text{非人寿保险}
            \end{cases}
            \\
            \text{风险转嫁方式}
            \begin{cases}
                \text{足额风险}
                \\
                \text{不足额保险}
                \\
                \text{超额保险}
            \end{cases}
            \\
            \text{业务承保方式}
            \begin{cases}
                \text{原保险}
                \\
                \text{再保险}
                \\
                \text{复合保险}
                \\
                \text{重复保险}
                \\
                \text{共同保险}
            \end{cases}
            \\
            \text{给付方式}
            \begin{cases}
                \text{定额保险与损失保险}
                \\
                \text{定额保险与利益保险}
                \\
                \text{现金保险与实物保险}
            \end{cases}
        \end{cases}
        \\        
        \text{保险政策}
        \begin{cases}
            \text{自愿保险与法定保险}
            \\
            \text{商业保险与社会保险}
            \\
            \text{普通保险与政策保险}
        \end{cases}
        \\
        \text{立法形式}
        \begin{cases}
            \text{财产保险与人身保险}
            \\
            \text{损失保险与人身保险}
            \\
            \text{损害保险与人寿保险}
            \\
            \text{财产、意外保险与人寿、健康保险}
        \end{cases}
        \\
        \text{经济因素}
        \begin{cases}
            \text{企业保险与个人保险}
            \\
            \text{团体保险与个人保险}
            \\
            \text{收入保险、财产保险、费用保险}
        \end{cases}
    \end{cases}
\]}    
\end{minipage}
\hfill 
\begin{minipage}[t]{0.5\textwidth}
\begin{tabular}{p{1.5cm}p{4.2cm}}
        \hline
        名词&解释
        \\
        \hline
        再保险&保险人将其承担前的保险业务,部分或全部转移给其他保险人的一种保险
        \\
        复合保险&保险人以保险利益的全部或部分,分别向数个保险人投保相同种类保险,签订数个保险合同,其保险金额总和不超过保险价值的一种保险
        \\
        重复保险&投保人以同一保险标的、同一保险利益、同一危险事故分别向数个保险人订立合同的一种保险
        \\
        共同保险&投保人与两个以上的保险人之间,就同一保险利益、对同一危险共同缔结保险合同的一种保险
        \\
        普通保险&基于个人或经济单位风险保障的需要,经过自由选择而形成保险关系的一种保险
        \\
        收入保险&承保与工作能力的暂时或永久地、部分地丧失有关的经济损失
        \\
        费用保险&承保因无法预测的异常支出而造成的财产或收入上的损失
        \\
        \hline
    \end{tabular}    
\end{minipage}

\end{document}

1.请仔细阅读模板手册
1.png
最简单的办法就是使用 chinesefont = founder 到您的文档类选项. (当然您需要先下载字体)
效果如下:
2.png
当然, 这里的 \textbf 使用的是 FZHei-B01 字体
mwe:

\documentclass[lang=cn, 11pt,chinesefont = founder]{elegantbook}
\begin{document}

\begin{definition}{}{}
我要加粗{\bfseries 啦啦啦} \
我要加粗\textbf{啦啦啦}
\end{definition}

\end{document}

2.使用 chinesefont = ctexfont(默认选项), 很明显缺失字形,你需要简单配置一下
elegantbook.cls 第 214 行附近, 将如下代码替换

\ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
  \RequirePackage[UTF8,scheme=plain]{ctex}
  \xeCJKsetup{AutoFakeBold=true}
  }{\relax}

替换为:

\ifdefstring{\ELEGANT@chinesefont}{ctexfont}{
  \RequirePackage[UTF8,scheme=plain]{ctex}
  \setCJKfamilyfont{kaishu} {KaiTi}[AutoFakeBold]
  \renewcommand*{\kaishu}{\CJKfamily{kaishu}}
  }{\relax}

3.png

mwe:

\documentclass[lang=cn, 11pt]{elegantbook}
\begin{document}

\begin{definition}{}{}
我要加粗{\bfseries 啦啦啦} \
我要加粗\textbf{啦啦啦}
\end{definition}

\end{document}

  • title 内容默认白色,而你的背景也是白色.
  • 显示不全是因为你对 title 进行了平移,导致下面的 "内容" 框遮挡了它.
\documentclass{ctexart}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{calc}
\newtcolorbox{mybox}{
    enhanced,
    colbacktitle = white,
    attach boxed title to top center={ yshift = 0pt},
    title = 练习,
    coltitle = cyan,
    boxrule = 2pt,
        frame code={
        % 以下代码可实现取中点1
        \fill[color = green] (title.north west)--(title.north east)--([xshift = 0.3cm,yshift =-1pt]$(title.north east)!0.5!(title.south east)$)
        --(title.south east)--(title.south west)--([xshift = -0.3cm,yshift = -1pt]$(title.south west)!0.5!(title.north west)$)--cycle;
    }
    }
\begin{document}
    \begin{mybox}
        1.分别写出“两个三角形全等”和“两个三角形相似”的几个充要条件。\par 
    \end{mybox}

\end{document}

QQ截图20220926174848.png

cumcmthesis.cls 文件中做如下修改即可

%line 467 ~ 468
\renewcommand\thesubsection{\arabic{section}\thinspace.\thinspace\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection\thinspace.\thinspace\arabic{subsubsection}}

改为

\renewcommand\thesubsection{\arabic{section}\texorpdfstring{\thinspace.\thinspace}\arabic{subsection}}
\renewcommand\thesubsubsection{\thesubsection\texorpdfstring{\thinspace.\thinspace}\arabic{subsubsection}}

使用 LaTeX3 做一个简单实现


format.tex

\ExplSyntaxOn
\iow_new:N \l_count_file
\int_zero_new:N \l_topic_section_total_int 
\msg_new:nnn{topic}{undefined}{the~topic~counter~undefined,~please~compile~again!}
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[C]{\bfseries\thepage}
\file_if_exist:nTF{\c_sys_jobname_str.cnt}
{
  \file_input:n {\c_sys_jobname_str.cnt}
  \fancyfoot[L]{Total:~\textcolor{red}{\totaltopic}}
  \fancyfoot[R]{Current~section:~\textcolor{red}{\tl_use:c {current\roman{section}}}}
}
{
  \fancyfoot[L]{Total:~\textcolor{red}{??}}
  \fancyfoot[R]{Current~section:~\textcolor{red}{??}}
  \msg_warning:nn{topic}{undefined}
}

\cs_set_eq:NN \oldsection:n \section 

\RenewDocumentCommand\section{som}
{
  \int_compare:nNnF{\arabic{section}} = {0}
  {
    \iow_now:Nx \l_count_file {
      \expandafter\def\exp_not:c{current\roman{section}}{\int_use:c {l_topic_section_\roman{section}_int}}
    }  
  }
  \IfBooleanTF{#1}
  {
    \oldsection:n*{#3}
  }
  {
    \IfNoValueTF{#2}
    {
      \oldsection:n{#3}
    }
    {
      \oldsection:n[#2]{#3}
    }
  }
    \int_zero_new:c {l_topic_section_\roman{section}_int}
}

\cs_new:Npn \topic {
  \group_begin:
    \int_gincr:c {l_topic_section_\roman{section}_int}
    {\bfseries\noindent Topic.\thesection.\int_use:c {l_topic_section_\roman{section}_int}}~
}

\cs_new:Npn \endtopic {
  \par 
  \group_end:
}

\AtBeginDocument{
  \iow_open:Nn \l_count_file {\c_sys_jobname_str.cnt}
}
\AtEndDocument{
  \iow_now:Nx \l_count_file {
    \expandafter\def\exp_not:c{current\roman{section}}{\int_use:c {l_topic_section_\roman{section}_int}}
  }    
  \int_step_inline:nn{\arabic{section}}
  {
   \int_add:Nn \l_topic_section_total_int {\int_use:c {l_topic_section_\int_to_roman:n{#1}_int}}
  }
  \iow_now:Nx \l_count_file {
    \def\noexpand\totaltopic{\int_use:N \l_topic_section_total_int}
  }
  
  \iow_close:N \l_count_file
}
\ExplSyntaxOff

main.tex

\documentclass{article}
\usepackage{fancyhdr,xcolor}
\usepackage[margin = 3cm]{geometry}

\input format
\title{title}
\author{author}
\begin{document}
\maketitle
\tableofcontents
\section{aaa}
\begin{topic}
aaa
\end{topic}
\begin{topic}
  aaa
\end{topic}
\begin{topic}
aaa
\end{topic}
\begin{topic}
aaa
\end{topic}

\newpage

\section{bbb}
\begin{topic}
aaa
\end{topic}
\begin{topic}
aaa
\end{topic}

\newpage

\section{ccc}
\begin{topic}
aaa
\end{topic}

\end{document}

结果

1.png
2.png
3.png

发布
问题