13

I am trying to prepare printer labels for the spine of ring binders. The text is designed to be printed on label paper sheets with A4 format, having top and bottom margins of 26.5mm and left/right margins of 9mm.

The format of the labels is 61mm by 192mm, there are 4 of them on the sheet, without any separation between them.

I use the tcolorbox environment as a 'frame' for the labels and and perhaps my idea is to naive, but I just wrote four of such environments in a row with nobeforeafter setting for each (well, using \tcbset command).

Even with \parskip set to 0pt there is small spacing between the boxes of about 1mm, which would lead to a shift of the content consecutively, and the 4th box appears on the next page. Reducing the bottom margin is not an option, of course. I believe, that \parskip is of no use here anyway.

I am pretty sure, that the content of the boxes has no influence on the spacing, as long as the height is not too large, which does not seem to be the case here.

How can I reduce the space between those colorboxes to a effectively 'zero' value, resulting in no shift when printed?

Note

I checked the margins etc. after print out, they are correct!

Even if there might be other solution for such label printing, I would like to have some solution to reduce the spacing between the boxes (Ok, it might be a very trivial solution.)

enter image description here

This is the code I tried so far

\documentclass[12pt,paper=a4]{article}

\usepackage[lmargin=0.9cm,rmargin=0.9cm,tmargin=26.5mm,bmargin=26.5mm,showframe=true,a4paper]{geometry}
\usepackage{tcolorbox}
\usepackage{lmodern}


\begin{document}
\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt}%
\pagestyle{empty}%

\fontsize{80}{96}\selectfont 
\tcbset{height=61mm,nobeforeafter,top=2cm}
\begin{tcolorbox}%
\textbf{\LaTeX}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{is}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{very}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{sophisticated}%
\end{tcolorbox}

\end{document}

I looked into other 'similar' questions here, none of them seems to be connected to this problem

Note

Here is the result with some features of the tcolorbox package and the solutions by Gonzalo Medina and egreg together with the comment by Thomas F. Sturm.

enter image description here

  • An extra +1 (if it would be possible) for the result ;-) – Thomas F. Sturm Aug 3 '14 at 14:40
  • @ThomasF.Sturm: Thanks, I hope, you don't mind misusing your fascinating package! – user31729 Aug 3 '14 at 14:42
13

You need to cancel the natural \lineskip:

\documentclass[12pt,paper=a4]{scrartcl}

\usepackage[lmargin=0.9cm,rmargin=0.9cm,tmargin=26.5mm,bmargin=26.5mm,showframe=true,a4paper]{geometry}
\usepackage{tcolorbox}
\usepackage{lmodern}


\begin{document}
\setlength{\parindent}{0pt}%
\setlength{\parskip}{0pt}%
\pagestyle{empty}%

\fontsize{80}{96}\selectfont 
\offinterlineskip
\tcbset{height=61mm,nobeforeafter,top=2cm}
\begin{tcolorbox}%
\textbf{\LaTeX}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{is}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{very}%
\end{tcolorbox}
\begin{tcolorbox}%
\textbf{sophisticated}%
\end{tcolorbox}

\end{document}

enter image description here

In the above example, \offinterlineskip will have effect from the point where it was issued on. To have suppress the \lineskip in a more controlled way, one could use the after key in with

after=\par\nointerlineskip

as Thomas F. Sturm suggested in his comment.

  • Thank you for this solution. I was unaware of \offinterlineskip and after reading about it, I wondered, if this affects the lineskip within a tcolorbox also. This is true, since a text spread over, say, two lines becomes too narrow. An individual \nointerlineskip after each box just to prevent the skip between the boxes, but not inside it, provides an error message – user31729 Aug 3 '14 at 5:31
  • @ChristianHupfer You need an additional \par for it. Setting after=\par\nointerlineskip will do the trick :-) – Thomas F. Sturm Aug 3 '14 at 8:39
  • Either add a group around this or use Thomas' suggestion: \offinterlineskip would go on forever while \nointerlineskip is “just once”. – egreg Aug 3 '14 at 12:24
  • @ThomasF.Sturm: Thanks, I will test it afterwards. For the moment I am fine with one-line-texts – user31729 Aug 3 '14 at 14:29
  • @egreg: Thanks, see my comment answer to Thomas F. Sturm. – user31729 Aug 3 '14 at 14:30
7

The spacing is due to \lineskip; the usual setting of \parskip is to have zero natural width, so it can add vertical space only when \flushbottom is set, because it has a stretch component of 1pt. In this case, you should set it to zero and also set \lineskip to zero, but in a group to avoid the setting going on forever.

\documentclass[12pt,paper=a4]{scrartcl}

\usepackage[lmargin=0.9cm,rmargin=0.9cm,tmargin=26.5mm,bmargin=26.5mm,showframe=true,a4paper]{geometry}
\usepackage{tcolorbox}
\usepackage{lmodern}


\begin{document}

\begingroup
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\setlength{\lineskip}{0pt}

\fontsize{80}{96}\selectfont 
\tcbset{height=61mm,nobeforeafter,top=2cm}
\begin{tcolorbox}
\textbf{\LaTeX}
\end{tcolorbox}
\begin{tcolorbox}
\textbf{is}
\end{tcolorbox}
\begin{tcolorbox}
\textbf{very}
\end{tcolorbox}
\begin{tcolorbox}
\textbf{sophisticated}
\end{tcolorbox}

\endgroup % the empty line is needed

\end{document}

enter image description here

Why is \lineskip intervening? Because each line has height plus depth larger than \baselineskip, so the difference between “depth of the line above plus height of the line below” and \baselineskip is larger than \lineskiplimit (usually 0pt), hence TeX inserts \lineskip glue, thinking that the lines are too near to each other.

A different solution, from a comment by Thomas F. Sturm, is adding after=\par\nointerlineskip to the options to tcolorbox:

\tcbset{height=61mm,top=2cm,after=\par\nointerlineskip,before={}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy