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}
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

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.