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

注册于 3年前

回答
372
文章
0
关注者
14

刚看文档抄的... 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文件作为示例。

related link

\documentclass{beamer}
\usetheme{Berlin}
\usepackage{ctex}
\usepackage{amsmath}
\usefonttheme{serif}
\usepackage{cleveref}
\usepackage{hyperref}
\crefformat{equation}{#2式~(#1#3)}

\let\chyperref\cref
\renewcommand{\cref}[1]{{\hyperlink{#1}{\chyperref{#1}}}}

\begin{document}

\section{问题重述}
\begin{frame}{问题重述}
    这是上帝公式
    \begin{equation}
        \mathrm{e}^{\mathrm{i}\pi}+1=0
        \label{eq:1}
    \end{equation}
\end{frame}

\begin{frame}
    \cref{eq:1}是最美的公式。
\end{frame}

\end{document}

另外,原始MWE带来的警告与这个问题似乎是相同的...

The beamer document class redefines the \label command in a particularly devious way...

我觉得你不应该用计数器proof以及\theproof的值来控制长度。

另外我没看懂『前后无间距以使得悬挂缩进可以实现』,以及subsize是想实现什么...

如果你需要『悬挂缩进』,其实latex2e是有类似的quote环境的:

image.png

%article.cls
\newenvironment{verse}
               {\let\\\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em%
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}%
                \item\relax}
               {\endlist}
\newenvironment{quotation}
               {\list{}{\listparindent 1.5em%
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}%
                \item\relax}
               {\endlist}
\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}%
                \item\relax}
               {\endlist}

另外,代码要给完整...同时最好详细描述proof以及subsize想达到的预期效果示意图。

提供代码要完整,可编译。

一个也许你的复现如下:

\documentclass{article}
\usepackage[a4paper,showframe]{geometry}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{xcolor}
\begin{document}
\begin{figure}[h]
    \centering
    \caption[Sparse-SIM resolves known structures of ~60 nm in size.]{Sparse-SIM resolves known structures of ~60 nm in size.}
    \includegraphics[width=.6\linewidth]{example-image}
    \begin{minipage}{\textwidth}
    {\color{red}\textbf{This is the table notes}}\\
    \lipsum[1-6]%
    \end{minipage}
\end{figure}
\end{document}

image.png

那你确实要么只能缩小字体,要么只能压缩内容。

提问必须提供完整的MWE。

确实如此,请查看texdoc amsthm的文档。

image.png

\documentclass{article}
\usepackage{amsthm}
\newtheorem{mythmA}{ThmA}
\theoremstyle{definition}
\newtheorem{mythmB}{ThmB}
\setlength{\parindent}{0pt}
\begin{document}

This is a theorem with a custom label.

\begin{mythmA}
This is a theorem with a custom label.
\end{mythmA}

\begin{mythmB}
This is a theorem with a custom label.
\end{mythmB}

This is a theorem with a custom label.

\end{document}

image.png

考古....

一个比较方便的办法是使用paracol提供的\columnratio{.6667}:

\documentclass{article}
\usepackage{microtype}
\usepackage[a4paper,margin=1in]{geometry}
\usepackage{paracol}
\usepackage{lipsum}
\usepackage{graphicx}
\columnratio{.6667}

\begin{document}

\begin{paracol}{2}
\lipsum[1-5]
\switchcolumn
\lipsum[1]

\noindent\includegraphics[width=5cm]{example-image}

\lipsum[2]
\end{paracol}

\end{document}

image.png

提问必须要给最小工作示例

希望上下两行的能够换行的答题线长度之和是定值,暂定为9em,考虑到通用性,希望可以指定任意合理的长度

不完全符合OP的需求,但也许可以借用xeCJkfntef提供的hidden选项,用多个之间的间隙来实现自动换行。

\documentclass{ctexart}
\usepackage[showframe,margin=1in]{geometry}
\usepackage{enumitem}
\setlist[enumerate]{nosep,labelsep=0pt,leftmargin=2em}
\usepackage{multicol}
\setlength{\columnseprule}{.4pt}
\setlength{\columnsep}{1cm}
\usepackage{xeCJKfntef}
\newcommand{\gentext}[2][啊]{%
    \ifnum#2>0\relax%
        #1\gentext{\numexpr#2-1}\unskip%
    \fi%
}
\newcommand*{\myrule}[2][.4pt]{%
    \CJKunderline[hidden,thickness=#1]{\gentext{#2},\gentext{#2}}
}
\begin{document}

\noindent\textbf{16. }补写出下列句子中的空缺部分。(6分)

\begin{multicols}{2}

\begin{enumerate}[label=(\arabic{enumi})]
    \item 
    王湾《次北固山下》的名句“\myrule{5}”,描写时序交替中的景物,暗示着时光流逝,蕴含着自然理趣。
    \item 
    小慧为朋友家的农家乐餐厅写宣传横幅,直接使用了陆游《游山西村》里的“\myrule{7}”两句诗,朋友看了觉得很贴切。
    \item 
    行至群山深处,见到一挂瀑布飞泻而下,水石激荡,轰鸣作响,于老师回头对学生们说:“这不就是古诗中写的‘\myrule{9}’嘛!”
\end{enumerate}

\end{multicols}

\noindent\textbf{参考答案:}

\begin{enumerate}[label=(\arabic{enumi})]
    \item 
    海日生残夜\quad 江春入旧年
    \item 
    山重水复疑无路\quad 柳暗花明又一村
    \item 
    飞流直下三千尺\quad 疑是银河落九天(飞湍瀑流争喧豗\quad 砯崖转石万壑雷)
\end{enumerate}

\end{document}

image.png

发布
问题