o(∩_∩)o
o(∩_∩)o
这家伙很懒,什么也没写!

注册于 3年前

回答
12
文章
0
关注者
0

这是移动\bool_new:N \l_is_answer_bool位置后的代码

\documentclass{ctexart}
\usepackage{xparse,enumitem}
\ExplSyntaxOn
\bool_new:N \l_only_show_answer_bool
\bool_new:N \l_is_answer_bool
\bool_set_false:N \l_only_show_answer_bool%想通过这个bool来只显示答案
\seq_new:N \l_answer_seq
\NewDocumentCommand{\answer}{+m}{
    \seq_gput_right:Nn \l_answer_seq{#1}
}
\NewDocumentEnvironment{ceshi}{O{} +b}{%
    \bool_if:NTF \l_only_show_answer_bool
    {   
        
        \bool_set_false:N \l_is_answer_bool
        \tl_map_inline:nn {#2}
        {
            \bool_if:NTF \l_is_answer_bool
            {
                \answer{##1}
                \bool_set_false:N \l_is_answer_bool
            }
            {
                \str_compare:nNnT {\tl_to_str:n {##1}} = {\tl_to_str:n {\answer}}
                {
                    \bool_set_true:N \l_is_answer_bool
                }
            }
        }
    }
    {
        \UseHook{env/enumerate/before}%
        \UseHook{env/enumerate/begin}%
        \enumerate[#1]%
              #2
        \endenumerate%
        \UseHook{env/enumerate/end}%
        \UseHook{env/enumerate/after}%
    }
}{}
\AtEndDocument{
    \newpage
    \begin{flushleft}
        这是答案
    \end{flushleft}
    \seq_map_inline:Nn \l_answer_seq{
        \noindent
        #1
        \par
    }
}
\ExplSyntaxOff
\begin{document}
    \begin{ceshi}[resume]
        \item   这是第一个\answer{答案1}
        \item   这是第二个\answer{答案2}
    \end{ceshi}
\end{document}

佬,还有两个问题
第一个是,组内是\task被花括号包裹在里面的意思吗?
第二个是,没有解析到item是什么意思呀?
第三个是,查了interface3\exp_not:V还是不太明白
麻烦了

mwe.zip
加入on line

\documentclass{ctexart}
\usepackage[most]{tcolorbox}
\usepackage{zhlipsum}

% 定义一个不会换行的命令
\newtcbox{\myexample}{
    enhanced,
    left=1pt,
    right=1pt,
    top=2pt,
    bottom=2pt,
    boxrule=-1pt,
    toprule=1pt,
    colback=white,
    colframe=cyan,
    on line, % 确保命令在行内执行,不会导致换行
}

\newcounter{examplecounter}
\setcounter{examplecounter}{1}
\newtcolorbox{example}{
    enhanced,
    breakable,
    colback=white,
    colframe=white,
    colbacktitle=cyan!10,
    coltitle=cyan,
    attach title to upper,
    title=\myexample{例~\theexamplecounter} ,
    before upper=\tcbtitle \;,
}

\begin{document}

\begin{example}
    \zhlipsum[12]
\end{example}

\end{document}

谢谢大佬,长知识了,但是不明白这个问题是怎么产生的

雾月老师,我还是没有修改正确,麻烦看一下

\documentclass{ctexart}
\usepackage{tabularray}
\SetTblrInner[tblr]{%
    cells={c},
    hlines,
    vlines,
}
\begin{document}
    \ExplSyntaxOn

    \newcommand{\tl}{  
    \seq_set_split:Nnn \l_my_seq_a {,}{a,b,c,d,ef}
    \int_step_inline:nnn{1}{\seq_count:N \l_my_seq_a}
    {
        \int_compare:nNnTF {##1}<{\seq_count:N \l_my_seq_a}{
            ##1 & 
        }
        {
            ##1 \\
        }
    }   
    \int_seq_inline:nnn{1}{\seq_count:N \l_my_seq_a}{
        \int_compare:nNnTF {##1}<{\seq_count:N \l_my_seq_a}{
            \seq_item:Nn \l_my_seq_a {##1 &}
        }
        {
            \seq_item:Nn \l_my_seq_a {##1}
        }
    }
    }
    \begin{tblr}[expand=\tl]{}
        \tl
    \end{tblr} 
    \ExplSyntaxOff
\end{document}

经过大佬提醒在外网看到了解决办法加入环境
`begin{NoHyper}
...
end{NoHyper}
`

\documentclass{ctexart}
\usepackage{hyperref}%问题出现在这里,如果不用这个宏包就没问题,但我需要用这个宏包
\usepackage{enumitem}
\newcommand{\juantou}{
     本试卷共4页,22小题,满分150分,考试用时120分钟.\\
    \textbf{注意事项:}
\begin{NoHyper}
    \begin{minipage}[t]{.8\linewidth}%
    \begin{enumerate}[itemsep=0pt,partopsep=0pt,parsep=\parskip,topsep=0pt]
        \item   答卷前,考试务必将自己的姓名、考生号、考场号和座位号填写在答题卡上.用
                2B 铅笔将试卷类型(A)填涂在答题卡相应的位置上.将条形码横贴在答题卡
                右上角“条形码粘贴处”.
        \item   作答选择题时,选出每小题答案后,用 2B 铅笔在答题卡上对应题目选项的答
                案信息点涂黑;如需改动,用橡皮擦干净后,再选涂其他答案.答案不能答在试
                卷上
        \item   非选择题必须用黑色字迹的钢笔或签字笔作答,答案必须写在答题卡各题目指
                定区域内相应位置上;如需改动,先划掉原来的答案,然后再写上新答案;不准
                使用铅笔和涂改液.不安以上要求作答无效.
        \item   考生必须保持答题卡的整洁.考试结束后,将试卷和答题卡一并交回.
    \end{enumerate}
\end{minipage}
\end{NoHyper}
}
\begin{document}
\juantou
\begin{enumerate}
    \item  测试
    \item  测试
    \item  测试
\end{enumerate}
\end{document}

上图贴的代码有问题

\documentclass[margin=1cm]{standalone}
\usepackage{tikz,ctex}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture} 
    \begin{axis}[%
        title=2022年居民消费价格月度涨跌幅度,
        legend pos=north west,
        legend columns=2,
        xlabel=2022年,
        ylabel=$\%$,
        ymin=-3.0,
        ymax=6.0,
        xtick distance=3,
        xtick={1,2,...,12},
        xticklabels={{1月},{2月},{3月},{4月},{5月},{6月},{7月},{8月},{9月},{10月},{11月},{12月}},
        xticklabel style={xshift=-0.25cm,yshift=0mm},
        ytick={-3,0,3,6},
        ylabel style={xshift=3cm,yshift=-0.6cm,rotate=90}
        ]
        \addplot+[mark=*,black] coordinates {
        (1, 0.9)
        (2, 0.9)
        (3, 1.5)
        (4, 2.1)
        (5, 2.1)
        (6, 2.5)
        (7, 2.7)
        (8, 2.5)
        (9, 2.8)
        (10, 2.1)
        (11,1.6)
        (12,1.8)
    };
    \addplot+ [mark=triangle*,black] coordinates {
   (1, 0.4)
   (2, 0.6)
   (3, 0)
   (4, 0.4)
   (5, -0.2)
   (6, 0)
   (7, 0.5)
   (8, -0.1)
   (9, 0.3)
   (10, 0.1)
   (11,-0.2)
   (12,0)
};
\legend{月度同比,月度环比}
    \end{axis} 
    \end{tikzpicture}
\end{document}

请问\advance是什么意思呢?这些命令去哪里看,学习呢?麻烦了

不好意思我附件传错了,谢谢大佬!请问一下expand是tex命令吗?另外expand这些命令,需要看什么文档呢?麻烦了

发布
问题