重新创建 Stack Exchange 教程片段

重新创建 Stack Exchange 教程片段

我在最近的一篇 Stack Exchange 教程中看到了一个片段问题拖船并想在 TikZ 中制作它。

所需的 SE 教程片段

我无法重新创建钢笔投票标志、复制复选标记以及将标题放在阴影框中。

我目前拥有的:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, positioning, calc}
\usepackage{amssymb}

\begin{document}
\begin{tikzpicture}
\node (top box) [draw=gray, align=center, rounded corners, text width=3.5cm, minimum width=4.5cm] at (0,1.5) {Click here to \textit{upvote} any useful post};
\node (bottom box) [draw=gray, align=center, rounded corners, text width=3.5cm, minimum width=4.5cm] at (0,0) {Click here to \textit{accept} the best answer to your question};

\node (upvote) [draw, circle, color=gray, above left = 0.1 and 1 of top box.west] {up};
\draw [->, >=stealth, color=gray] (top box.west) -- (upvote);

\node (votes) [color=gray, below = 0.2 of upvote] {1};
\node (downvote) [color=gray, below = 0.2 of votes] {down};

\node (best answer) [draw, color=gray, circle, below left = 0.1 and 1 of bottom box.west] {\checkmark};
\draw [->, >=stealth, color=gray] (bottom box.west) -- (best answer);

% surrounding box
\coordinate (top right) at ($(current bounding box.north east) + (1,1)$);
\coordinate (bottom left) at ($(current bounding box.south west) - (1,0.3)$);
\draw [color=gray, thick, rounded corners] (bottom left) rectangle (top right);

\node (box title) [above = 0.3 of upvote] {How to thank};
\end{tikzpicture}
\end{document}

我的 SE 教程片段

非常感谢您对此的帮助:)

答案1

范达克教授非常抱歉,因为您可能会失望,但这支钢笔和对勾只是文章撰写时 TeX.SE 网站上的一张截图的剪辑。

如果你将此图片保存为tick.png

在此处输入图片描述

并编译此文档:

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}

\usepackage[many]{tcolorbox}
\tcbset{%
    enhanced,
    before skip=6pt plus 2pt minus 2pt,
    after skip=6pt plus 2pt minus 2pt,
    unbreakable,
    colframe=orange,
    colback=white,
    coltitle=black,
    halign=center,
    fonttitle=\bfseries,
    boxed title style={colback=yellow!70!white}
}

\begin{document}
    \begin{tcolorbox}[adjusted title={How to thank},
        attach boxed title to top, top=0pt]
        \begin{tikzpicture}[%
            tondo/.style={circle, draw=orange, thick, text width=1.5em},
            quadro/.style={%
                rounded corners, draw=orange, thick, 
                align=center,
                font={\small},
                text width=12em,
                minimum height=9ex
            },
            freccia/.style={orange, thick, -stealth}
            ]
            \node[inner sep=0pt] (foto) {\includegraphics[width=.15\linewidth]{tick}};
            \node[tondo, below=6pt of foto.north, anchor=north] (upv) {};
            \node[tondo, above=1pt of foto.south, anchor=south] (acc) {};
            \node[quadro, right=10em of upv.north, anchor=north] (dupv) 
                {Click here to \emph{upvote} \\ any useful post};
            \node[quadro, right=10em of acc.south, anchor=south] (dacc)
                {Click here to \emph{accept} \\ 
                the best answer to your question};
            \draw[freccia] (dacc.west) -- (acc);
            \draw[freccia] (dupv.west) -- (upv);
        \end{tikzpicture}
    \end{tcolorbox}
\end{document}

你会得到:

在此处输入图片描述

然而,在 Ti 中重新创建这些符号非常简单Z,它们在这里:

\documentclass[twocolumn]{article}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning, matrix, fit}
\tikzset{
    fountainpen/.pic = {
        \node[circle, fill=lightgray, inner sep=.9pt, outer sep=0pt](start){};
        \draw[#1, lightgray] (start) -- (0,.5);
        \draw[#1, line width=1pt, lightgray] (0,.5) to[out=-80,in=130] (.2,.05) to[out=-100,in=90] (.17,-.11) -- (-.17,-.11) to[out=90,in=-80] (-.2,.05) to[out=50, in=-100] cycle;
    },
    checkmark/.pic = {
        \fill[lightgray] (0,0) to[out=60, in=210] (.25,.25) -- (.25,.43) to[out=220, in=70] (-.01,.1) to[out=100, in=-45] (-.1,.24) -- (-.2,.15) to[out=-30, in=130] cycle;
    },
    tondo/.style={circle, draw=orange, thick, text width=1.5em},
    quadro/.style={%
                rounded corners, draw=orange, thick, 
                align=center,
                font={\small},
                text width=12em,
                minimum height=9ex
            },
    freccia/.style={orange, thick, -stealth}
}
\usepackage[many]{tcolorbox}
\tcbset{%
    enhanced,
    before skip=6pt plus 2pt minus 2pt,
    after skip=6pt plus 2pt minus 2pt,
    unbreakable,
    colframe=orange,
    colback=white,
    coltitle=black,
    halign=center,
    fonttitle=\bfseries,
    boxed title style={colback=yellow!70!white}
}

\begin{document}
    \begin{tcolorbox}[adjusted title={How to thank},
        attach boxed title to top]
        \begin{tikzpicture}
            \pic[local bounding box=penhigh] {fountainpen};
            \node[text=gray, below =7pt of penhigh] (one) {1};
            \pic[local bounding box=penlow,  below =10pt of one] {fountainpen={rotate=180}};
            \pic[local bounding box=check,  below =24pt of penlow] {checkmark};
            \node[tondo] at (penhigh) (upv) {};
            \node[tondo] at (check) (acc) {};
            \node[quadro, right=10em of upv.north, anchor=north] (dupv) 
                {Click here to \emph{upvote} \\ any useful post};
            \node[quadro, right=10em of acc.south, anchor=south] (dacc)
                {Click here to \emph{accept} \\ 
                the best answer to your question};
            \draw[freccia] (dacc.west) -- (acc);
            \draw[freccia] (dupv.west) -- (upv);
        \end{tikzpicture}
    \end{tcolorbox}
\end{document}

在此处输入图片描述

相关内容