2

There are some things I want to be arranged as seen in the images below Original rectangle:

enter image description here I want this: (The colors in the corners don't matter.) enter image description here

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes.misc}
\usetikzlibrary{calc,shapes.misc}

\newcommand\around{% \begin{tikzpicture}[overlay, remember picture] \draw[line width=2.1pt] {[rounded corners=0] ($(current page.north west)+(1cm,-4cm)$) -- ++(0,2cm) -- ($(current page.north east)+(-1cm,-2cm)$)} -- ++(0,-2cm) -- cycle; \draw[fill=yellow,line width=2.1pt] {[rounded corners=15] ($(current page.north west)+(1cm,-2cm)$) -- ++(0,1cm) -- ($(current page.north east)+(-15cm,-1cm)$)} -- ++(0,-1cm) -- cycle; \draw[fill=yellow,line width=2.1pt] {[rounded corners=15] ($(current page.north west)+(+15cm,-2cm)$) -- ++(0,1cm) -- ($(current page.north east)+(-1cm,-1cm)$)} -- ++(0,-1cm) -- cycle; \draw[fill=yellow,line width=2.1pt] {[rounded corners=0] ($(current page.north west)+(+6.3cm,-2cm)$) -- ++(0,1cm) -- ($(current page.north east)+(-6.3cm,-1cm)$)} -- ++(0,-1cm) -- cycle; \end{tikzpicture} \vspace{3cm} } \begin{document} \around \end{document}

SebGlav
  • 19,186
cufcuf
  • 594
  • 1
    There is an answer to a similar question here: https://tex.stackexchange.com/a/118786/118712 (Note, that I am NOT refering to the accepted answer, but the other one by user Holi) Maybe you can adapt that code to your use case. – Markus G. Sep 07 '21 at 22:17

1 Answers1

1

Using a node like this can be a bit tricky, as is evident from many solutions to similar questions like to one I linked to in the comments. It is probably easier to default to drawing the actual rectangle manually using rounded corners, like so:

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand\around{% \begin{tikzpicture}[overlay, remember picture] \draw[line width=2.1pt] {[rounded corners=15] ($(current page.north west)+(1cm,-4cm)$) -- ++(0,3cm) -- ($(current page.north east)+(-1cm,-1cm)$)} -- ++(0,-3cm) -- cycle; \end{tikzpicture} \vspace{3cm} }

\begin{document} \around \end{document}

EDIT: Based on your new question you can do this:

\documentclass[a4paper]{article}
\usepackage[margin=1.5cm]{geometry}
\usepackage{tikz}
\usetikzlibrary{calc}

\newcommand\around{% \begin{tikzpicture}[overlay, remember picture,line width=2.1pt] \draw ($(current page.north west)+(1cm,-4cm)$) rectangle ($(current page.north east)+(-1cm,-2cm)$);

    \draw[fill=yellow] {[rounded corners=15] ($(current page.north west)+(1cm,-2cm)$) -- ++(0,1cm)} -- ++(5cm,0) -- ++(0,-1cm) -- cycle;
    \draw[fill=yellow] {[rounded corners=15] ($(current page.north east)+(-1cm,-2cm)$) -- ++(0,1cm)} -- ++(-5cm,0) -- ++(0,-1cm) -- cycle;
    \draw[fill=yellow] ($(current page.north)+(-4cm,-2cm)$) -- ++(0,1cm) -- ($(current page.north)+(4cm,-1cm)$) -- ++(0,-1cm) -- cycle;
\end{tikzpicture}
\vspace{3cm}

} \begin{document} \around \end{document}

Note that it is extremely bad practice to load packages more than once and that tikz automatically loads graphicx.

Markus G.
  • 2,735