0

Is there way to align the colored box in the header flushright and without the white line between the header and box with the text centered? I was trying something with mdframed, but the box was to high. enter image description here

\documentclass[9pt]{extarticle}

\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{fancyhdr}
\pagestyle{fancy}

\lhead{}
\chead{}
\rhead{\colorbox{black}
{\footnotesize\bfseries{\makebox[4.5em]
{\color{white}Article}}}
}
\renewcommand{\headrulewidth}{1pt}

\begin{document}
    text
\end{document}

1 Answer 1

2

Use \fcolorbox (from xcolor) and add a % at the end of this command:

\documentclass[9pt]{extarticle}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{fancyhdr}
\pagestyle{fancy}

\lhead{}
\chead{}
\rhead{\fcolorbox{black}{black}
{\footnotesize\bfseries{\makebox[4.5em]
{\color{white}Article}}}%
}
\renewcommand{\headrulewidth}{1pt}

\begin{document}
    text
\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .