使用 tikz 塑造卡片

使用 tikz 塑造卡片

如何使用 tikz 制作形状卡片。我想创建以下内容。在此处输入图片描述

我已经创建了形状,但问题是如何在它们周围制作网格。

这是我目前所得到的。

%\documentclass[12pt, border=5mm]{standalone}
\documentclass{standalone}

\usepackage{tikz}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{xcolor}
\usetikzlibrary{shapes.geometric}
\definecolor{amber}{rgb}{1.0, 0.75, 0.0}
\begin{document}

                  



\begin{tikzpicture}
\draw[ultra thick,amber] (0,0) node[anchor=north]{$$}
  -- (4,0) node[anchor=north]{$$}
  -- (2,4) node[anchor=south]{$$}
  -- cycle;
\node[fill=red] (2) at (0, 0) [circle,draw,red] {};
\node[fill=red] (2) at (4, 0) [circle,draw,red] {};
\node[fill=red] (2) at (2, 4) [circle,draw,red] {};
  \end{tikzpicture}
  
  \begin{tikzpicture}
\draw[ultra thick,amber] (0,0) node[anchor=north]{$$}
  -- (0,4) node[anchor=north]{$$}
  -- (2,4) node[anchor=south]{$$}
    -- (2,0) node[anchor=south]{$$}
  -- cycle;
\node[fill=red] (2) at (0, 0) [circle,draw,red] {};
\node[fill=red] (2) at (0, 4) [circle,draw,red] {};
\node[fill=red] (2) at (2, 4) [circle,draw,red] {};
\node[fill=red] (2) at (2, 0) [circle,draw,red] {};
  \end{tikzpicture}
  
  
    \begin{tikzpicture}
\draw[ultra thick,amber] (0,0) node[anchor=north]{$$}
  -- (0,4) node[anchor=north]{$$}
  -- (4,4) node[anchor=south]{$$}
    -- (4,0) node[anchor=south]{$$}
  -- cycle;
\node[fill=red] (2) at (0, 0) [circle,draw,red] {};
\node[fill=red] (2) at (0, 4) [circle,draw,red] {};
\node[fill=red] (2) at (4, 4) [circle,draw,red] {};
\node[fill=red] (2) at (4, 0) [circle,draw,red] {};
  \end{tikzpicture}


\begin{tikzpicture}
\node[minimum size=5cm,draw,regular polygon,regular polygon sides=5,amber,ultra thick] (a) {};
\foreach \i in {1,...,5}
    \node[red,fill=red,circle,radius=.1cm,draw,
    label=above:{$$},
    fill=red] at (a.corner \i) {};
\end{tikzpicture}


\begin{tikzpicture}
\node[minimum size=5cm,draw,regular polygon,regular polygon sides=6,amber,ultra thick] (a) {};
\foreach \i in {1,...,6}
    \node[red,fill=red,circle,radius=.1cm,draw,
    label=above:{$$},
    fill=red] at (a.corner \i) {};
\end{tikzpicture}

\begin{tikzpicture}
\node [ultra thick, amber,star,draw,fill=white,minimum size=5cm,star point ratio=2] (a) {};
%\foreach \i in {1,...,5}
   %at (a.corner \i) {};
   \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (0,2.5) {};
    \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (0.7,1.1) {};
     \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (2.2,0.7) {};
        \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-2.2,0.7) {};
           \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-0.7,1.1) {};
           
               \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-1.4,-1.9) {};
               \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (1.4,-1.9) {};
               \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-1.4,-1.9) {};
               
               \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-0.,-1.3) {};
               
                  \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (1.3,-0.4) {};
                  
                     \node[circle,draw=red, fill=red, inner sep=0pt,minimum size=4mm] (b) at (-1.3,-0.4) {};
\end{tikzpicture}
%
%\begin{tikzpicture}[dot/.style={circle,fill,inner sep=2pt}]
%\def\r{2}  % radius of the star
%\def\n{4}  % n+1 = number of vertexes
%\def\Vlabel{{"$V_a$","$V_b$","$V_c$","$V_d$","$V_e$"}}
%\foreach \i in {0,...,\n}
%\path ({90+\i*360/(\n+1)}:\r) coordinate (V\i) node[dot]{}
%+({90+\i*360/(\n+1)}:.4) node{\pgfmathparse{\Vlabel[\i]}\pgfmathresult}
%;
%\draw (V2)--(V0)--(V3)--(V1)--(V4)--cycle;
%\end{tikzpicture}



\end{document}

答案1

shapes.geometric可以使用tikzlibrary中包含的节点绘制几何形状。

边框可以用节点绘制fit。完整的卡片可以是独一无二的。但这里它由一个(包)tikzpicture组成,允许组合具有不同几何形状和不同内容的不同盒子。tcbpostertcolorbox

\documentclass[border=0pt, crop, multi=tcbposter]{standalone}
%\documentclass{article}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}

\begin{document}
\begin{tcbposter}[%
    poster = {%showframe, 
        spacing=1mm, columns=2, rows=3},
    coverage = {width= 95mm, height=62mm, boxrule=1mm, frame style=yellow!85!black, borderline={1mm}{1mm}{green!70!black}},
    boxes = {colframe=green!70!black, colback=white, rounded corners, valign=center, halign=center}
]
\posterbox[frame hidden, halign=left]{name=title, row=1, span=2, rowspan=0.4}{Some nice title}
\posterbox[tikz upper]{column=1, below=title, span=1.2, rowspan=1.5}{%
\node[regular polygon, regular polygon sides=3, minimum size=2cm, draw=yellow, line width=1mm] (triangle) {};
\foreach \i in {1,2,3}
    \filldraw[orange] (triangle.corner \i) circle (1mm);
}
\posterbox{column*=2, below=title, span=0.8, rowspan=1.5}{B}
\posterbox{column=1, above=bottom, rowspan=1.1}{C}
\posterbox{column=2, above=bottom, rowspan=1.1}{D}
\end{tcbposter}
\end{document}

在此处输入图片描述

相关内容