[Tex/LaTex] Customize author and affiliation using authblk

authblktitles

I have some problems when customizing author and affiliation using authblk.

xxx

The above picture shows the author and affiliation format generated by my MWE.

I want to:

  1. typeset the author names bold face. I use the command \renewcommand*{\Authfont}{\bfseries}. However, it will turn both author names and affiliation boldface. I do not know what the problem is.
  2. I want to put XXXXX in affiliation 1 together with 200021 in a new line. How can I achieve this? Thanks.

The following is my MWE:

\documentclass{article}
\usepackage[left=3.00cm, right=3.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage{authblk}

\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }
\renewcommand*{\Affilfont}{\normalsize}
%\renewcommand*{\Authfont}{\bfseries}    % make author names boldface    
\setlength{\affilsep}{2em}   % set the space between author and affiliation

\title{Aa Article Title}
\author[1]{Aaaaaa Aa}
\author[1*]{Bbbbb Bb}
\author[2]{Ccccccc Ccc}
\affil[1]{Department of Chemical Engineering, University of AAAAA BBBBBB, CCCCC road, XXXXX 200021, Y Country} 
\affil[2]{AAAAAA Laboratory, University of AAAAA BBBBBB, XXXXX 303939, Z Country}
\date{}    

\begin{document}
\maketitle

This is an article.
\end{document}

Best Answer

enter image description here

  1. You need \normalfont for the affiliations to neutralize the boldfaced fonts for the authors:

    \renewcommand*{\Affilfont}{\normalsize\normalfont}
    \renewcommand*{\Authfont}{\bfseries}
    
  2. You can use a \parbox of the appropriate width inside \affil to have manual line breaks.

The code:

\documentclass{article}
\usepackage[left=3.00cm, right=3.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage{authblk}

\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }
\renewcommand*{\Affilfont}{\normalsize\normalfont}
\renewcommand*{\Authfont}{\bfseries}    % make author names boldface    
\setlength{\affilsep}{2em}   % set the space between author and affiliation

\newsavebox\affbox

\title{Aa Article Title}
\author[1]{Aaaaaa Aa}
\author[1*]{Bbbbb Bb}
\author[2]{Ccccccc Ccc}
\affil[1]{%
  \savebox\affbox{\Affilfont Department of Chemical Engineering, University of AAAAA BBBBBB, CCCCC road,}%
  \parbox[t]{\wd\affbox}{\protect\centering Department of Chemical Engineering, University of AAAAA BBBBBB, CCCCC road, \par XXXXX 200021, Y Country}} 
\affil[2]{AAAAAA Laboratory, University of AAAAA BBBBBB, XXXXX 303939, Z Country}
\date{}    

\begin{document}

\maketitle

This is an article.

\end{document}

For 2., instead of \parbox you can use a varwidth environment so you don't have to calculate lengths:

\documentclass{article}
\usepackage[left=3.00cm, right=3.00cm, top=2.00cm, bottom=2.00cm]{geometry}
\usepackage{authblk}
\usepackage{varwidth}

\renewcommand*{\Authsep}{, }
\renewcommand*{\Authand}{, }
\renewcommand*{\Authands}{, }
\renewcommand*{\Affilfont}{\normalsize\normalfont}
\renewcommand*{\Authfont}{\bfseries}    % make author names boldface    
\setlength{\affilsep}{2em}   % set the space between author and affiliation

\title{Aa Article Title}
\author[1]{Aaaaaa Aa}
\author[1*]{Bbbbb Bb}
\author[2]{Ccccccc Ccc}
\affil[1]{\protect\begin{varwidth}[t]{\linewidth}\protect\centering Department of Chemical Engineering, University of AAAAA BBBBBB, CCCCC road, \par XXXXX 200021, Y Country\protect\end{varwidth}} 
\affil[2]{AAAAAA Laboratory, University of AAAAA BBBBBB, XXXXX 303939, Z Country}
\date{}    

\begin{document}
\maketitle

This is an article.
\end{document}