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

注册于 3年前

回答
288
文章
0
关注者
12

关于『中文处理技术』,在这个回答的评论区中也有一些记载。

关于国内过时的『基于cctart类的模板』,在这个链接中也有一些信息(当然,要注意甄别是否过时)。

似乎有很明显的循环结构呀🧐

\documentclass{beamer} 
\usepackage{tikz}
\makeatletter
\newcommand{\Letter}[1]{\@Alph{#1}}
\makeatother
\newcommand{\myplot}[1]{
    \foreach \i[evaluate=\i as \j using (\i/(1+#1))] in {1,...,#1} {
        \node[minimum size=2cm,font=\tiny,align=center] at (\j\linewidth,0) {\Letter{\i}\\(\j,0)};
    }
}
\begin{document} 
\tikzset{every node/.style={draw,dotted,inner sep=.5cm}}
\begin{frame}
\centering%
\tikz{\myplot{1}}\medskip

\tikz{\myplot{2}}\medskip

\tikz{\myplot{3}}\medskip

\tikz{\myplot{4}}\medskip

\end{frame}
\begin{frame}
    \centering%
    \foreach \x in {4,...,1}{%
        \tikz{\myplot{\x}}\par\medskip
    }
\end{frame}
\end{document} 

image.png

Edit:

node里的内容通常是写一大段不相同的文字,怎么循环?

也许用clist会挺方便(?)可以自己设计一下syntax(例如\mydraw{C,A,V,X})

我自己写的时候没注意到\centering的重要作用😡,怀疑人生了好一会儿...

\documentclass{beamer} 
\usepackage{tikz}
\begin{document} 
\tikzset{every node/.style={draw,dotted,inner sep=.5pt}}
\ExplSyntaxOn
\NewDocumentCommand{\mydraw}{m}{%
    \clist_set:Nn \l_tmpa_clist {#1}
    % \clist_use:Nn \l_tmpa_clist {;} \par
    \int_set:Nn \l_tmpa_int { \clist_count:N \l_tmpa_clist }
    \begin{tikzpicture}
        \foreach \i in {1,...,\l_tmpa_int} {%
            \def\j{\fpeval{round(\i/(1+\l_tmpa_int),4)}}% texdoc xfp
            \node[minimum~size=1.5cm,font=\tiny,align=center] at (\j\textwidth,0) {(\j)\\ \clist_item:Nn \l_tmpa_clist {\i}};
        }
    \end{tikzpicture}
}
\ExplSyntaxOff
\begin{frame}
    \centering%
    \mydraw{ahahaha,123456,1aaa2,{some~text,hia\\hiahia},kkk}\medskip

    \mydraw{I~am~A,You~are~B,He~is~C}\medskip

    \mydraw{C,A,B,F,E,H,G}\medskip
\end{frame}
\end{document} 

image.png

此事在这个issues亦有记载。但我不太认可:

ctex+article不如ctexart

这一说法。

本问题的一个等价的mwe为:

\documentclass{article}
\makeatletter
\def\@zihao{5}
\makeatother
\usepackage[zihao=\@zihao]{ctex}
% \usepackage[zihao=5]{ctex}
\usepackage{zhlipsum}
\begin{document}

\zhlipsum[name=zhufu]

\end{document}

这是一个宏展开问题。

image.png

你做过任何尝试🤔?
你至少要把框架的代码给出来,再具体说明你遇到的难题是什么(例如求交点)。


不要提出自己没有付出任何努力的问题(from 提问的智慧)

image.png

可以试试封装度更高的tkz-euclide

\documentclass[border=5pt]{standalone}
\usepackage{tkz-euclide}
\begin{document}
\begin{tikzpicture}[line cap=round]
\tkzDefPoints{0/0/B,6.5/0/D,4/4/A,4.5/-1.5/C}
\tkzDrawSegments[thick](A,B A,C A,D B,C C,D)
\tkzDefMidPoint(A,B) \tkzGetPoint{B'}
\tkzDefMidPoint(A,C) \tkzGetPoint{C'}
\tkzDefMidPoint(A,D) \tkzGetPoint{D'}
\tkzDefMidPoint(B,D) \tkzGetPoint{G}
\tkzDefMidPoint(C,B) \tkzGetPoint{E}
\tkzDefMidPoint(C,D) \tkzGetPoint{F}
\tkzInterLL(B',F)(D',E) \tkzGetPoint{M}
\tkzDrawSegments[dashed](B,D B',F E,D')
\tkzDrawPoints[black](A,B,C,D,E,F,G,B',C',D',M)
\tkzLabelPoints[above](A)
\tkzLabelPoints[left](B,B',C',M)
\tkzLabelPoints[below](C,E,G)
\tkzLabelPoints[right](D,F,D')
\end{tikzpicture}
\end{document}

image.png

预期得到两份答案: 使用longtblr环境实现更好的内容与样式分离

我基于tabularraylongtblr也做了一个尝试:

  • Q列格式可以让你直接摆脱longtable的列格式和array宏包和valign的混合指定,我也妹弄得很明白...
  • 使用header可以实现重复标题行的功能,且该设置位于longtable的环境外,适合移植批量配置表格样式
  • 使用row{1}={font=\bfseries}也可以避免使用四次\textbf的尴尬支持
  • 似乎文档更建议用\adjustimage代替\adjustbox{\includegraphics{}}
  • tabularray!优雅永不过时~
\documentclass[fontset=fandol]{ctexart}
\usepackage[margin=1in,landscape]{geometry}
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{tabularray}
\newcommand*{\inserttxt}{I can eat the glass and it doesn't hute me.}
\DeclareTblrTemplate{contfoot-text}{normal}{(见下页)}
\SetTblrTemplate{contfoot-text}{normal}
\DeclareTblrTemplate{conthead-text}{normal}{ -- 续上页表格}
\SetTblrTemplate{conthead-text}{normal}

\begin{document}
    
\section{我是一个章节章节章节}

\begin{longtblr}[
    label = {tblr:a longtblr},
    caption = {这是一个长长长长长长长长长长长长表格},
    ]{
        colspec = {Q[c,m,1cm]Q[m,4cm]Q[m,5cm]Q[c,m,5.5cm]},vlines,hlines,
        row{1} = {font=\large\bfseries,halign=c},
        row{2-5} = {ht=4cm},
        width = .6\linewidth,%自行控制
        stretch = 0,
        rowhead = 1,
    }
    No. & Content & Content & Graphs \\
    1 & \inserttxt & \inserttxt & \adjustbox{valign=m, margin=3pt 5pt}{\includegraphics[width=5cm,height=3.5cm]{example-image-A}} \\
    2 & \inserttxt\inserttxt & \inserttxt\inserttxt & \adjustbox{valign=m, margin=3pt 5pt}{\includegraphics[width=5cm,height=3.5cm]{example-image-B}} \\
    3 & \inserttxt\inserttxt\inserttxt & \inserttxt\inserttxt\inserttxt & \adjustbox{valign=m, margin=3pt 5pt}{\includegraphics[width=5cm,height=3.5cm]{example-image-C}} \\
    4 & Alpha & Beta & \adjustimage{valign=m, margin=3pt 5pt,width=5cm}{example-image} \\
\end{longtblr}
    
\end{document}

image.png

当代码够短时,不要上传文件。实际上长的代码就不应该发上来提问。

您的标签能不能别乱写!!!! 第N+1次了,『解1去掉1』作为tag质量十分低劣!!!

image.png


查看tcolorbox文档...

image.png

所以你的问题等价于,在\newtheorem如何去掉1?

请自行对比和思考下例:

\documentclass{ctexart}
\usepackage{amsmath}
\newtheorem{MySolution}{解}
\begin{document}
\begin{MySolution}
    \begin{equation*}
        \int_{0}^{1} \frac{1}{x} \mathrm{d}x = \int_{0}^{1} \frac{1}{x} \cdot \frac{1}{1    \mathrm{d}x} = \int_{0}^{1} \frac{1}{1} \cdot \frac{1}{x} \mathrm{d}x = \int_{0}^{1} \frac{1}{x} \mathrm{d}x.
    \end{equation*}
\end{MySolution}
为什么会有\texttt{1}呢? 这一问题实际上与\texttt{tcolorbox}毫无关系.
\end{document}

image.png

\documentclass{ctexart}
\usepackage{amsmath}
\usepackage{amsthm}
\newtheorem*{MySolution}{解}
\begin{document}
\begin{MySolution}
    \begin{equation*}
        \int_{0}^{1} \frac{1}{x} \mathrm{d}x = \int_{0}^{1} \frac{1}{x} \cdot \frac{1}{1    \mathrm{d}x} = \int_{0}^{1} \frac{1}{1} \cdot \frac{1}{x} \mathrm{d}x = \int_{0}^{1} \frac{1}{x} \mathrm{d}x.
    \end{equation*}
\end{MySolution}
\end{document}

image.png

刚看文档抄的... maybe related link by 鱼老师

\documentclass[a4paper,twoside,12pt,openany]{ctexbook}
\usepackage[margin=1in]{geometry}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\definecolor{tianyi}{HTML}{66CCFF}
\definecolor{yanhe}{HTML}{00FFCC}
\definecolor{ling}{HTML}{EE0000}
\definecolor{qingxian}{HTML}{FFFF00}
\definecolor{skyblue}{HTML}{aeeafa}
\definecolor{darkblue}{RGB}{60,0,180}
% math typesetting
\usepackage{amsmath,amsthm,amssymb}
\usepackage{lipsum,zhlipsum}
\begin{document}

\NewTColorBox[auto counter,number within=chapter]{mytcbbox}{O{black}m}{
    enhanced jigsaw,breakable,colframe=#1,top=2ex,boxrule=2pt,toprule=0pt,fonttitle=\large\bfseries,colback=white,sharp corners,attach boxed title to top left={xshift=3em,yshift=-\tcboxedtitleheight/2},coltitle=#1,title={Definition\thetcbcounter~#2},
    boxed title style={%
        empty,left=1pt,right=1pt,bottom=0pt,sharp corners,
        overlay={%
            \draw[color=#1,line width=2pt,line cap=round]
            ([yshift=-1pt]frame.west)--
            ++(-2.9em,0) ([yshift=-1pt]frame.east)--
            ++(3em,0);
        }
    },
}

\chapter{chap1}
\begin{mytcbbox}{My Def Title}
    \lipsum[2]
\end{mytcbbox}

\begin{mytcbbox}[qingxian]{My Def Title}
    \lipsum[1]
\end{mytcbbox}

\begin{mytcbbox}[tianyi]{My Def Title}
    I can eat the glass band it doesn't hurt me. I can eat the glass band it doesn't hurt me. I can eat the glass band it doesn't hurt me.
\end{mytcbbox}

\chapter{chap2}
\begin{mytcbbox}[yanhe]{My Def Title}
    我能吞下玻璃而不伤身体. 我能吞下玻璃而不伤身体. 我能吞下玻璃而不伤身体. 我能吞下玻璃而不伤身体. 我能吞下玻璃而不伤身体. 我能吞下玻璃而不伤身体. 
\end{mytcbbox}

\begin{mytcbbox}[darkblue]{My Def Title}
    \zhlipsum[2]
\end{mytcbbox}

\begin{mytcbbox}[skyblue]{My Def Title}
    \zhlipsum[name=zhufu]
\end{mytcbbox}

\end{document}

image.png

Note:

  1. 懂得使用md代码块,这非常好(!)
  2. 题目还可以改进,需要体现这个样式的特征,例如『实现boxrule断开样式』而不是泛泛的『实现某种特定的边框』,好的题目可以让本post更容易被需要的人搜到

3.

上边框仅绘制两端长度为 3 em (可调整)的部分

因为一些原因,我不想暴露出控制这个长度的接口,如果确有需要修改,你可以自行试试修改以下绘制横线的长度(-2.9em3em):

overlay={%
    \draw[color=#1,line width=2pt,line cap=round]
    ([yshift=-1pt]frame.west)--++(-2.9em,0) 
    ([yshift=-1pt]frame.east)--++(3em,0);
}

我希望的效果:

  • 整个表格除了苹果二字,都出现在第一帧,直至结尾;
  • 苹果二字在第二帧出现,直至结尾.

我不明白为什么你需要嵌套\visible,本身就是可见的呀。写得更tabularray-style一点,以下就可以满足你的需求:

\documentclass{beamer}
\usepackage{tabularray}
\begin{document}

\begin{frame}{frametitle}
    Hello!\par
    \begin{tblr}{hlines,vlines,colspec={*{2}{Q[c,3cm]}},cell{2}{2}={cmd=\visible<+->}}
        1 & 2 \\
        3 & apple
    \end{tblr}
    
    \visible<+->{something else}
\end{frame}

\end{document}

image.png


这是为什么?

Claim:以上并不是不是完整的回答,提供一些层次递进的探索结果:

\documentclass{beamer}
\usepackage{tabularray}
\begin{document}
\begin{frame}{frametitleA}
    \visible<+->{%
        visible stuff

        \visible<+->{invisible stuff}
    }
\end{frame}

\begin{frame}{frametitleB}
    \visible<+->{%
        \begin{tabular}{|c|c|}
            \hline
            1 & 2 \\
            \hline
            3 & \visible<+->{invisible stuff}\\
            \hline
        \end{tabular}
    }
\end{frame}

\begin{frame}{frametitleC}
    \visible<+->{%
        \begin{tblr}{hlines,vlines}
            1 & 2 \\
            3 & \visible<+->{invisible stuff}
        \end{tblr}
    }
\end{frame}

\begin{frame}{frametitleD}
    \visible<+->{%
        \begin{tblr}{hlines,vlines,colspec={*{2}{Q[c,3cm]}}}
            1 & 2 \\
            3 & \visible<+->{invisible stuff}
        \end{tblr}
    }
\end{frame}
\end{document}

1.不使用任何环境,只做overlay specification的嵌套:

image.png

2.在tabular环境中嵌套使用:

image.png

3.在tblr中但不指定colspec={*{2}{Q[c,3cm]},此时beamerpauses递增了五次...:

image.png

4.在tblr中且指定colspec={*{2}{Q[c,3cm]},正如OP所述,递增了三次:

image.png


Edited:

Thanks to samcarter_is_at_topanswers.xyz:

If you don't set a colspec yourself, tabularray needs to first count how many columns there are, before it can start its normal doings.

要想解决上述由于tabularray造成beamerpauses计数错误的问题,调用counter子库即可(texdoc tabularray sec5.3),这将只产生两页slides:

\documentclass{beamer}
\usepackage{tabularray}
\UseTblrLibrary{counter}
\begin{document}
\begin{frame}
\frametitle{frametitle}
    \visible<+->{%
        \begin{tblr}{hlines,vlines,colspec={*{2}{Q[c,3cm]}}}
            1 & 2 \\
            3 & \visible<+->{invisible stuff}
        \end{tblr}
    }
\end{frame}
\end{document}

image.png

Never use \\, use \noindent if needed.
\documentclass{ctexart}
\usepackage{hanzibox}
\hanziboxset{frametype=咪,framecolor=red,charcolor=red,pinyinline=true,charf=\Huge,pinyinf=\tiny}
\setlength{\parindent}{0pt}%
\begin{document}

\hanzibox{你好}

\hanzibox{你好啊啊啊}

\end{document}

或者

\documentclass{ctexart}
\usepackage[showframe]{geometry}
\usepackage{hanzibox}
\hanziboxset{frametype=咪,framecolor=red,charcolor=red,pinyinline=true,charf=\Huge,pinyinf=\tiny}
\begin{document}

\noindent\hanzibox{你好}

\noindent\hanzibox{你好啊啊啊}

\end{document}

image.png

\documentclass{ctexart}
\usepackage{tikz}
\newcommand\myzheng[1][5]{%
    \begin{tikzpicture}[
        baseline=(zheng.base),
        every node/.style={inner sep=0pt,outer sep=0pt,font=\heiti},
    ]%
    \node (zheng) {正};%
    \ifnum#1<5\relax%
    \fill[white] (-.45em,-.68ex) rectangle ++(.9em,-.25ex);%
    \fi%
    \ifnum#1<4\relax%
    \fill[white] (-.3em,-.7ex) rectangle ++(.1em,1.1ex);%
    \fi%
    \ifnum#1<3\relax%
    \fill[white] (.058em,-.01em) rectangle ++(.33em,.2ex);%
    \fi%
    \ifnum#1<2\relax%
    \fill[white] (-.05em,-.7ex) rectangle ++(.12em,1.428ex);%
    \fi%
\end{tikzpicture}%
}
\begin{document}

% \begin{tikzpicture}
% \node {正};
% \end{tikzpicture}

% \begin{tikzpicture}
%     \node {正};
%     \fill[white] (-.45em,-.68ex) rectangle ++(.9em,-.25ex);
% \end{tikzpicture}

% \begin{tikzpicture}
%     \node{正};
%     \fill[white] (-.45em,-.68ex) rectangle ++(.9em,-.25ex);
%     \fill[white] (-.3em,-.7ex) rectangle ++(.1em,1.1ex);
% \end{tikzpicture}

% \begin{tikzpicture}
%     \node {正};
%     \fill[white] (-.45em,-.68ex) rectangle ++(.9em,-.25ex);
%     \fill[white] (-.3em,-.7ex) rectangle ++(.1em,1.1ex);
%     \fill[white] (.058em,-.01em) rectangle ++(.33em,.2ex);
% \end{tikzpicture}

% \begin{tikzpicture}
%     \node {正};
%     \fill[white] (-.45em,-.68ex) rectangle ++(.9em,-.25ex);
%     \fill[white] (-.3em,-.7ex) rectangle ++(.1em,1.1ex);
%     \fill[white] (.058em,-.01em) rectangle ++(.33em,.2ex);
%     \fill[white] (-.05em,-.7ex) rectangle ++(.12em,1.428ex);
% \end{tikzpicture}

你\begin{tikzpicture}[baseline=(zheng.base),inner sep=0pt,outer sep=0pt,font=\heiti]
    \node[draw=cyan] (zheng) {正};
\end{tikzpicture}好

\foreach \i in {1,...,5}{%
    \myzheng[\i] \quad
}

你是\foreach \i in {1,...,5}{第\myzheng[\i]个}猫娘小蛋糕

\end{document}

image.png

由于赶时间,细节没有做调整,欢迎自行微调。

且...这个想法比较trivial,不知道是否有更好的实践。

随缘改了下...

\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\definecolor{bg@main}{RGB}{254,216,71}
\definecolor{bg@second}{RGB}{249,241,179}
\definecolor{bg@third}{RGB}{247,234,156}
\definecolor{text@main}{RGB}{254,216,71}
\definecolor{text@second}{RGB}{2,49,102}
\definecolor{text@third}{RGB}{162,148,65}
\usepackage[paperwidth=16.51cm, paperheight=24.77cm]{geometry}
\def\maketitle{%
    \newgeometry{margin=0pt}
    \begin{titlepage}
        \begin{tikzpicture}[remember picture, overlay]
            \def\textnode[##1]##2;{%
                \node[anchor=west, align=left, ##1] ##2;
            }
            \fill[left color=bg@second] (current page.north west) rectangle (current page.south east);
            \fill[bg@main] (current page.south east) rectangle ++(-0.9\paperwidth, 0.69\paperheight) coordinate (t1);
            \fill[bg@third] (t1) rectangle ++(-0.1\paperwidth, -0.137\paperheight);
            
            \draw[white, very thick] (current page.north west) ++ (.1\paperwidth, 0) -- ++ (0, -\paperheight);
            \draw[white, very thick] (current page.north west) ++ (0, -.31\paperheight) -- ++ (\paperwidth, 0);
            \draw[white, very thick] (current page.north west) ++ (0, -.447\paperheight) -- ++ (.1\paperwidth, 0);
            
            \textnode[text=text@third, font=\LARGE] at ([xshift=0.1\paperwidth + 0.75cm, yshift=-0.75cm]current page.north west) {Graduate Text in Mathematics};
            \textnode[text=text@main, scale=5, anchor=north east] at (current page.north east) {GTM};
            \textnode[text=text@second, anchor=south west, scale=2.4] at ([xshift=0.75cm]t1) {Mathematician Analysis};
            \textnode[text=text@second, anchor=north west, scale=7] at ([xshift=0cm]t1) {Introduction \\ to Real \\ Analysis};
            % 插入自定义图片并调整
            \node[anchor=south east] at ([shift={(-1cm,1cm)}]current page.south east) {%
                \begin{minipage}[b][1.5cm][c]{2cm}
                    \hfill\includegraphics[width=1.5\linewidth]{springer_horse.png}
                \end{minipage}%
                \begin{minipage}[b][1.5cm][c]{3cm}
                    \centering \huge\bfseries Springer
                \end{minipage}
            };
        \end{tikzpicture}
    \end{titlepage}
    \restoregeometry
}
\begin{document}
    \maketitle
\end{document}
  • 如果你不懂,就不要乱改别人的参数,在参考链接中明明是:
\def\textnode[##1]##2;{%
                \node[anchor=west, align=left, ##1] ##2;%
            }%

怎么到你这里一抄就变成了#1#2(?)你能解释解释吗...

  • 请自行学习tikznode的用法
  • 同时再自行学习minipage环境的用法

image.png

不会markdown语法不要提问。

P.S. markdown语法是很重要的,问题描述也要完整,清楚

P.S. 遇到报错最好附上报错信息(给你补上了),更容易被其他人检索到关键词。

  • \tikzset不需要;
\tikzset{
            declare function={
                f(\x)=cos(\x r);
                g(\x)=\fpeval{1/3};
                h(\x)=-0.5;
            }
        };
  • 参照文档好像是更快的办法...

image.png

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,calc,intersections}
\begin{document} 
    \begin{tikzpicture}
        \tikzset{
            declare function={
                f(\x)=cos(\x r);
                g(\x)=\fpeval{1/3};
                h(\x)=-0.5;
            }
        }
        \draw[-Stealth] ({-2.1*pi},0)--({2.2*pi},0)node[below]{$x$};
        \draw[-Stealth] (0,-1.5)--(0,1.5)node[left]{$y$};
        \draw[name path=s,domain=-2*pi:2*pi,samples=600] plot (\x,{f(\x)});
        \draw[name path=l,color=cyan,domain=-2*pi:2*pi,samples=600] plot (\x,{g(\x)});
        \draw[name path=ll,color=cyan,domain=-2*pi:2*pi,samples=600] plot (\x,{h(\x)});
        \fill[name intersections={of=s and l,name=P,total=\t}] 
             [color=red] \foreach \i in {1,...,\t}{(P-\i) circle (1pt) node[above] {$\i$}};
    \end{tikzpicture}
\end{document}

image.png

有一点改善,但没有完全解决:

提供一个related issues

也许可供参考(?)但其实问题并没有解决...感觉应该在哪里reported过

\documentclass[aspectratio=169]{beamer}
\usepackage[noindent]{ctexcap}
\usepackage{amsfonts, amsmath}
\usetheme{Madrid}
\usecolortheme{default}
\usefonttheme{professionalfonts}
% \usefonttheme[onlymath]{serif}
% \AtBeginDocument{%
%     \DeclareSymbolFont{pureletters}{T1}{\mathfamilydefault}{\mddefault}{it}%
%     }
\begin{document}
\begin{frame}
    $\dot{H}^{1/2}$
\end{frame}
\end{document}

image.png

Edit:

SwitWu老师 @u20011 指出,使用unicode-math可以有效解决这一问题:

image.png

有关math accent与beamer的爱恨情仇,还可见:这个链接

请按照这个链接的操作确定这是什么字体。或者提供单页的PDF文件作为示例。

发布
问题