# tikz shape “tape” with rounded corners

I am trying to use the shape "tape" with rounded corners using the following code:

\documentclass[12pt]{scrartcl}

\usepackage{tikz}
\usetikzlibrary{%
shapes,
}
\tikzset{
document/.style={
shape=tape,
rounded corners=5pt,
minimum width=5cm,
inner ysep=15pt,
draw,
align=center,
fill=white,
font=\fontsize{20}{20}\sffamily\bfseries,
tape bend top=none,
},
}
\begin{document}
\begin{tikzpicture}
\node[document] (node1) {files};
\end{tikzpicture}
\end{document}


which gives me this:

any sugestions how to fix the line in the lower right corner?

• Is a radius of rounded corners=1.5ptenough? Keeping the radius value low enough helps to avoid the overshoot of the curve. – moospit Feb 21 '17 at 15:32

We can find the definition of this shape in pgflibraryshapes.symbols.code.tex. What we need to investigate is the background part:

\backgroundpath{%
\tapedimensions%
%
\pgf@xc\halfwidth%
\pgf@yc\halfheight%
%
{%
\pgftransformshift{\centerpoint}%
\pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}%
\pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
\ifx\topbendstyle\pgf@lib@sh@inandouttext%
\else%
\ifx\topbendstyle\pgf@lib@sh@outandintext%
\else%
\pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
\fi%
\fi%
% ⬇️⬇️⬇️ NOTICE THIS LINE ⬇️⬇️⬇️ (a)
\pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
\ifx\bottombendstyle\pgf@lib@sh@inandouttext%
% ⬇️⬇️⬇️ NOTICE THIS LINE ⬇️⬇️⬇️ (b)
\else%
\ifx\bottombendstyle\pgf@lib@sh@outandintext%
\else%
% ⬇️⬇️⬇️ NOTICE THIS LINE ⬇️⬇️⬇️ (c)
\pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
\fi%
\fi%
\pgfpathclose%
}%
}


Roughly speaking the drawing goes as follows

• start from west edge
• draw straight line to northwest corner
• draw straight line to northeast corner
• draw straight line to southeast corner
• user want curved bottom!!
• draw short straight line toward south (still at southeast corner)
• draw curve to southwest corner
• draw straight line to west, close the path

In terms of 's low level commands, there are two consecutive \pgfpathlineto commands and the second line is very short.

This will confuse the rounded corners mechanism because cannot tell if you are going up or down.

If you can replace these two \pgfpathlinetos by just one, then there will be no problem. For instance, you can move line (a) to (c), and then there will be only one line in any case.

There is an exactly same bug at the northwest corner. To prove my point, move line (d) to line (e) and compile the following MWE

\documentclass[tikz,border=30]{standalone}

\usetikzlibrary{%
shapes,
}

\makeatletter

\def\pgf@sh@bg@tape{
\tapedimensions%
%
\pgf@xc\halfwidth%
\pgf@yc\halfheight%
%
{%
\pgftransformshift{\centerpoint}%
\pgfpathmoveto{\pgfqpoint{-\halfwidth}{0pt}}%
% ⬇️⬇️⬇️ NOTICE THIS LINE ⬇️⬇️⬇️ (d)
\pgfpathlineto{\pgfqpoint{-\halfwidth}{\halfheight}}%
\ifx\topbendstyle\pgf@lib@sh@inandouttext%
\else%
\ifx\topbendstyle\pgf@lib@sh@outandintext%
\else%
% ⬇️⬇️⬇️ NOTICE THIS LINE ⬇️⬇️⬇️ (e)
\pgfpathlineto{\pgfqpoint{\halfwidth}{\halfheight}}%
\fi%
\fi%
\ifx\bottombendstyle\pgf@lib@sh@inandouttext%
\else%
\ifx\bottombendstyle\pgf@lib@sh@outandintext%
\else%
\pgfpathlineto{\pgfqpoint{\halfwidth}{-\halfheight}}%
\pgfpathlineto{\pgfqpoint{-\halfwidth}{-\halfheight}}%
\fi%
\fi%
\pgfpathclose%
}%
}

\tikzset{
document/.style={
shape=tape,
rounded corners=5pt,
minimum width=5cm,
inner ysep=15pt,
draw,
align=center,
fill=white,
font=\fontsize{20}{20}\sffamily\bfseries,
tape bend top=none,
}
}
\begin{document}
\begin{tikzpicture}
\node[document] (node1) {files};
\end{tikzpicture}

\begin{tikzpicture}
\node[document,tape bend top=in and out] (node1) {files};
\end{tikzpicture}
\end{document}