3

Here is a MWE:

\documentclass{scrartcl}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{fancyhdr,tcolorbox}
\pagestyle{fancy}
\cfoot{\tcbox[colback=Khaki1!25!white,colframe=DarkGoldenrod2!75!black,arc=1mm,width=5cm]{\textit{\emph{\thepage}}}}


\begin{document}

abc

\end{document} 

The result at the bottom of the page is:
enter image description here

Why the box is not 5cm long?

Thank you!

  • You should use scrlayer-scrpage instead fancyhdr if you use KOMA-Script classes like acrartcl ... – Kurt Mar 18 at 23:03
7

You need to change the capture mode, if you want the box not to fit to the contents:

\documentclass{scrartcl}
\usepackage[svgnames,x11names]{xcolor}
\usepackage{fancyhdr,tcolorbox}
\pagestyle{fancy}
\cfoot{\tcbox[capture=minipage,colback=Khaki1!25!white,colframe=DarkGoldenrod2!75!black,arc=1mm,width=5cm]{\textit{\emph{\thepage}}}}


\begin{document}

abc

\end{document} 

enter image description here

  • My compliments. I was trying to read the manual :-) – Sebastiano Mar 18 at 22:57
  • When I tried to add shadow - it's not added, do you now why? Thank you!! – heblyx Mar 18 at 23:01
  • shadows need the enhanced skin. – Ulrike Fischer Mar 18 at 23:02
  • Yes, I put \tcbuselibrary{skins} but still there is no shadow... – heblyx Mar 18 at 23:03
  • 1
    Works fine for me, enhanced,drop shadow=blue, gives a shadow. – Ulrike Fischer Mar 18 at 23:06

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.