# Dimension too large with tcolorbox and fading paths

I have this "Dimension too large" error that I don't understand:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{mybox}{
enhanced,
colframe=white,
colback=white,
overlay={
}
}
\begin{document}
\begin{mybox}
content goes here
\end{mybox}
\end{document}


I'm trying to decorate a box with fading lines from starting from the corners and going south, north, east, etc. Some work (e.g. from the north west angle fading to east), some (e.g. the one in the mwe) don't.

Why is that? I understand why the "dimension" error arises but I can't seem to understand why it does in this case. I can't see which computation is exceeding the -16384 < x < 16384 range here.

Also, is this fixable?

You can mimic a rectangle whose width is equal to the line width of the line to get a line.

overlay={
\draw[thick,red,path fading=south]([xshift=-0.4pt]frame.north east) rectangle (frame.south east);


Note the xshift=-0.4pt. Here we are actually drawing a rectangle that looks like a line.

Full code:

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{mybox}{
enhanced,
colframe=white,
colback=white,
overlay={
\draw[thick,red,path fading=south]([xshift=-0.4pt]frame.north east) rectangle (frame.south east);
\draw[thick,red,path fading=north]([xshift=-0.4pt]frame.south west) rectangle (frame.north west);
}
}
\begin{document}
\begin{mybox}
content goes here
\par
\vspace{4in}
Some content again
\end{mybox}
\end{document}


I have drawn two lines. Add more as you like.

I think it's just a typing mistake. If instead of

(frame.north east)--(frame.south east)


you write

(frame.north west) rectangle (frame.south east)


you'll get

\documentclass{article}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\newtcolorbox{mybox}{
enhanced,
colframe=white,
colback=white,
overlay={
\draw[thick, red, path fading=south](frame.north west) rectangle (frame.south east);
}
}
\begin{document}
\begin{mybox}
content goes here
\end{mybox}
\end{document}

• But I don't want the full rectangle. I want a line that goes from northeast to south east fading south, then a like that goes to south west to north west fading north. Then, in another box, I want the horizontal lines, etc. And by the way, why my code aobve fails while \draw[thick,red,path fading=east](frame.north west)--(frame.north east); works? – Efrem Apr 25 '14 at 12:31
• @Efrem: I didn't read your question carefully enough. You need to fade an area as thin as you want but with non zero width. Harish's solution shows it. You'll find a similar discussion in Fading of horizontal lines is impossible? – Ignasi Apr 26 '14 at 7:17
• thanks for the link, I think I understand the reason why it happens now. – Efrem Apr 26 '14 at 16:50