如何用 tikz 设置边距格式

如何用 tikz 设置边距格式

我想在姓名、学校和老师下面添加一些线条,如下图所示,这样即使使用几何包更改边距的格式,下面的布局也不会改变,保持不变。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[font=\sffamily,remember picture,overlay]
\path (current page.north) 
   node[below=0.7cm,
        draw=black,
        fill=white,
        minimum width=0.95\paperwidth,
        minimum height=4cm, 
        rounded corners=15pt, 
        line width=3pt]   
                (box){};

\path (box.west) 
      node[right=1mm, align=left] %<distance can be changed to suit
 {{\fontsize{45pt}{65pt}\color{black}\textbf{Name:}}\\[5mm]
 {\fontsize{45pt}{65pt}\color{black}\textbf{School:}}\\[5mm]
 {\fontsize{45pt}{65pt}\color{black}\textbf{Teacher:}}};

% draw rectangle node
\path (current page.center) 
 node[draw,
      minimum width=0.98\paperwidth,
      minimum height=0.97\paperheight, 
        rounded corners=15pt, 
        line width=3pt] (box) {};

\end{tikzpicture}
\end{document}

我想在我创建的包中使用此代码,所以我不想依赖任何外部包。如果可能的话,当然可以!

答案1

在此处输入图片描述

\documentclass{article}
\pagestyle{empty} % Suppress page numbers
\usepackage{tikz}
\begin{document}
    \begin{tikzpicture}[font=\sffamily,remember picture,overlay]
        \path (current page.north west) node[
            below right,
            fill=darkgray,
            minimum width=\paperwidth,
            minimum height=3cm, 
            rounded corners=15pt, 
            line width=3pt
            ]   
                (box){};
        
        \path (box.west) node[
            right=5mm,
            align=left
            ] %<distance can be changed to suit
            {{\fontsize{45pt}{65pt}\color{white}\textbf{JS Bibra}}\\[2mm]
            {\fontsize{30pt}{20pt}\color{cyan}Advisor to TEX}\\[2mm]
            {\fontsize{10pt}{10pt}\color{white}\LaTeX\ development}};
        
    \end{tikzpicture}

\end{document}

相关内容