1

I am using authblk package to display the authors. I will try to use background yellow color highlighted author names. But the authblk package is not supported.

MWE:

\documentclass{article}

\usepackage[noblocks]{authblk}

\usepackage{color}
\newcommand{\snm}[1]{\fboxsep0pt\colorbox{yellow}{#1}}

\begin{document}

\title{Bad superscript with authblk / xltxtra}

\author{David \snm{Wilson}}
\affil{address1}

\author{Albert \snm{William}}    
\affil{address2}
  \maketitle

\snm{Sample Paragraph.} Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. Sample Paragraph. 

\end{document}

The \snm{} command is working paragraph environment. The same command is not working inside the \author{David \snm{Wilson}} command. Please advice how to get the required color background in author names.

My Required Output:

enter image description here

The same output should be appeared author names. How to get this using authblk package.

1 Answer 1

1

This will provide the required output with authblk package:

\newcommand{\snm}[1]{{\fboxsep.1pt%
\setbox1=\hbox{#1}%
\noexpand\colorbox{yellow}{\protect\phantom{#1}}%
\llap{#1\hbox{\protect\phantom{#1}}}\hskip-\wd1}}

Kindly note, this is intended to use inside the author block. For the other text area, you may use the original definition with a different name.

1
  • Your solution is awesome. Your solution is working perfectly. I heartily thank to you...
    – CS Kumar
    Nov 20, 2015 at 6:23

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.