# How to make single edges rounded with tikz?

I am not good with tikz. I know that this question has already been answered in general (like, for example, here), but I was not able to transfer it to my example. I have the following code:

\documentclass[a4paper]{article}

\usepackage{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{background}

\usetikzlibrary{calc}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=17pt,
]
($(current page.north west) + (1.2cm,-1cm)$)
rectangle
($(current page.south east) + (-1cm,2cm)$);
\end{tikzpicture}
}

\begin{document}
\lipsum
\end{document}


Which produces this type of rectangle around the whole page:

How can I make the NW and SE corners NON-rounded? So my special restriction is that I want the rectangle go all around the whole text, relative to the page size.

Just draw two different lines:

• one from the NW to EW to SE corners
• the other from the NW to SW to SE corners

With the rounded corners option, only the middle corner will become rounded:

Here's the full code:

\documentclass[a4paper]{article}

\usepackage{geometry}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{background}

\usetikzlibrary{calc}
\SetBgScale{1}
\SetBgAngle{0}
\SetBgColor{black}
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=17pt]
($(current page.north west) + (12mm,-12mm)$)
-- ($(current page.north east) + (-12mm,-12mm)$)
-- ($(current page.south east) + (-12mm,12mm)$);
\draw [line width=1pt,rounded corners=17pt]
($(current page.north west) + (12mm,-12mm)$)
-- ($(current page.south west) + (12mm,12mm)$)
-- ($(current page.south east) + (-12mm,12mm)$);
\end{tikzpicture}
}

\begin{document}
\lipsum
\end{document}


Edit

As Zarko says in the comments, a better solution is to use:

\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=17pt, ]
($(current page.north west) + (12mm,-12mm)$)
-| ($(current page.south east) + (-12mm,12mm)$)
($(current page.south east) + (-12mm,12mm)$)
-| ($(current page.north west) + (12mm,-12mm)$);
\end{tikzpicture}
}

• or shorter \draw [line width=1pt,rounded corners=17pt, ] ($(current page.north west) + (1.2cm,-1cm)$) -| ($(current page.south east) + (-1cm,2cm)$) ($(current page.south east) + (-1cm,2cm)$) -| ($(current page.north west) + (1.2cm,-1cm)$); – Zarko Dec 4 '17 at 17:17
• @Zarko +1 This is nicer than my solution. You should post it. – Andrew Dec 4 '17 at 17:23
• no, you bet me for 5 minutes ... you just add this possibilities to your answer ... – Zarko Dec 4 '17 at 17:25