Tikz 在标题后面隐藏一行

Tikz 在标题后面隐藏一行

我试图将线条隐藏在矩形后面,但没有成功。我尝试了填充命令,也移动了代码,但线条仍然穿过矩形。

有什么建议么?

\documentclass{report}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{multicol}
\usepackage{array}
\usepackage{xcolor}
\usepackage{graphicx}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows}
\usetikzlibrary{shapes.misc, positioning}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\usetikzlibrary{decorations.markings}
\usepackage[T1]{fontenc}
\tikzstyle arrowstyle=[scale=1]
\usepackage{tikz}
\pgfplotsset{compat=1.17}

\usepackage[absolute]{textpos}
\setlength{\TPHorizModule}{1mm}
\setlength{\TPVertModule}{1mm}


\usepackage{geometry}
 \geometry{
 left=.635cm,
        right=.635cm,
        top=2.54cm,
        bottom=2.54cm
 }

\begin{document}

\pagestyle{empty}




\begin{tikzpicture}
\draw(0,12)--(9,12)node[midway,sloped, draw, rounded rectangle]{\Large{Lessons Title}};
\draw (0,24)--(9,24) node[midway, sloped, draw, rounded rectangle, fill=white!50] {\Huge{Exit Slip}};
\draw[dashed] (9,24)--(9,12);

\draw (0,12 )-- (0,24) -- (18,24) -- (18,12) -- cycle;
\end{tikzpicture}

\end{document}

'''

答案1

基于为您提供最简单解决方案的评论,您可以采取以下措施,使您的代码更高效:

\documentclass{report}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{shapes.misc,calc}

\usepackage{geometry}
\geometry{hmargin=0.25in,vmargin=1in}

\begin{document}
    \pagestyle{empty}
    \begin{tikzpicture}[label/.style={draw,rounded rectangle,fill=white}]   
        \node[rectangle,minimum width=18cm,minimum height=12cm,draw] (A) {};
        \draw[dashed] (A.south) -- (A.north);
        
        \node[label,font=\Large] at ($(A.south)!.5!(A.south west)$){Lessons Title};
        \node[label,font=\Huge] at ($(A.north)!.5!(A.north west)$) {Exit Slip};
    \end{tikzpicture}
\end{document}

还要注意:tikz加载xcolorgraphicx因此您不需要再次加载它们(当然,如果您愿意,也可以)。pgfplots当前1.18,您最初多次加载多个tikz库,这并没有什么坏处,但也不会给您的代码带来任何有用的东西。

相关内容