[Tex/LaTex] Author biographies in elsarticle

biographyelsarticle

Some Elsevier journals such as Ad Hoc Networks require author biographies at the end of the manuscript. From the guide for authors:

Vitae
Include in the manuscript a short (maximum 100 words) biography of each author, along with a passport-type photograph accompanying the other figures.

Does the elsarticle document class define any specific environment for the author's to use for this (double column FWIW), similar to the way that IEEE journals have an IEEEbiography environment?

I came across the blog post Alternative LaTeX Format for Author Biography For a Journal Submission, though it's from 2009 and I'm hoping Elsevier has a standardized way of achieving the same result now without adding more packages.

Best Answer

Edit: See improved version below

This is a (preliminary) solution, defining a command for specifing an image, using wrapfig package and some of it's features and the author name as well as some information on the author.

The information is written to a file, which is included automatically at the end.

It misses some more features of course and some configuration possibilities at the moment.

Description of the parameters, see for special values the code and the the calling.

  1. Optional argument: Specify the options
  2. Image file name
  3. Author name
  4. Author information

\documentclass{elsarticle}
\usepackage{xparse}%

\usepackage{blindtext}

\usepackage{morewrites}

\usepackage{wrapfig}
\usepackage{xkeyval}%

\newwrite\authorbibfile%

\AtBeginDocument{%
  \immediate\openout\authorbibfile=\jobname.aub%
}%

\AtEndDocument{%
\immediate\closeout\authorbibfile
\InputIfFileExists{\jobname.aub}{}{}
}%


\makeatletter

\define@key{authorbib}{scale}[1]{%
\def\AuthorbibKVMacroScale{#1}%
}

\define@key{authorbib}{wraplines}[10]{%
\def\AuthorbibKVMacroWraplines{#1}%
}

\define@key{authorbib}{imagewidth}[4cm]{%
\def\AuthorbibKVMacroImagewidth{#1}%
}

\define@key{authorbib}{overhang}[10pt]{%
\def\AuthorbibKVMacroOverhang{#1}%
}


\define@key{authorbib}{imagepos}[l]{%
\def\AuthorbibKVMacroImagepos{#1}%
}

\makeatother

\presetkeys{authorbib}{imagepos=l,imagewidth=4cm,wraplines=15,overhang=20pt}{}

\newlength{\AuthorbibTopSkip}
\newlength{\AuthorbibBottomSkip}
\setlength{\AuthorbibTopSkip}{\baselineskip}
\setlength{\AuthorbibBottomSkip}{\baselineskip}


\NewDocumentCommand{\authorbibliography}{+o+m+m+m}{%
  \IfNoValueTF{#1}{%
  }{%
    \setkeys{authorbib}{#1}%
    \immediate\write\authorbibfile{%
      \string\begin{wrapfigure}[\AuthorbibKVMacroWraplines]{\AuthorbibKVMacroImagepos}[\AuthorbibKVMacroOverhang]{\AuthorbibKVMacroImagewidth}^^J
        \string\includegraphics[scale=\AuthorbibKVMacroScale]{#2}^^J
        \string\end{wrapfigure}^^J
    }%
  }%
  \IfNoValueTF{#3}{%
    \typeout{Warning: No author name}%
  }{%
    \immediate\write\authorbibfile{%
      \unexpanded{\vspace{\AuthorbibTopSkip}}^^J
      \string\noindent\relax
      \unexpanded{\textbf{#3}\par}^^J
      \string\noindent\relax
      \unexpanded{#4}^^J%
      \unexpanded{\vspace{\AuthorbibBottomSkip}}^^J
      }%
  }%
}%



\begin{document}

\blindtext

\authorbibliography[scale=0.3,wraplines=10,overhang=40pt,imagewidth=4cm,imagepos=r]{bild_erwin_schroedinger}{Erwin Schr\"odinger}{\blindtext}

\authorbibliography[scale=0.4,imagewidth=5cm,wraplines=13,overhang=-50pt]{bild_erwin_schroedinger}{Erwin Schr\"odinger}{\blindtext}

\authorbibliography[scale=0.3,wraplines=10,overhang=40pt,imagewidth=4cm,imagepos=r]{bild_erwin_schroedinger}{Erwin Schr\"odinger}{\blindtext}


\end{document}

enter image description here

Improved version : authorbiography.sty

\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{authorbiography}%

\usepackage{graphicx}%
\usepackage{xparse}%
\usepackage{textcomp}%

\usepackage{tocloft}

\usepackage{morewrites}%
\usepackage{wrapfig}%
\usepackage{xkeyval}%
\usepackage{etoolbox}%

\usepackage{tcolorbox}%

\newwrite\authorbibfile%

\AtBeginDocument{%
  \immediate\openout\authorbibfile=\jobname.aub%
}%


\newlength{\AuthorbioTopSkip}%
\newlength{\AuthorbioBottomSkip}%
\setlength{\AuthorbioTopSkip}{\baselineskip}%
\setlength{\AuthorbioBottomSkip}{\baselineskip}%




\define@key{authorbio}{wraplines}[10]{%
\def\AuthorbioKVMacroWraplines{#1}%
}

\define@key{authorbio}{imagewidth}[4cm]{%
\def\AuthorbioKVMacroImagewidth{#1}%
}

\define@key{authorbio}{overhang}[10pt]{%
\def\AuthorbioKVMacroOverhang{#1}%
}


\define@key{authorbio}{imagepos}[l]{%
\def\AuthorbioKVMacroImagepos{#1}%
}

\define@key{authorbio}{yearofbirth}[]{
  \def\AuthorbioKVMacroYearofbirth{#1}%
}%

\define@key{authorbio}{yearofdeath}[]{
\def\AuthorbioKVMacroYearofdeath{#1}%
}%


\define@key{authorbio}{BiographyName}[1]{%
\def\AuthorbioKVMacroBiographyName{#1}%
}%


\newtoggle{AuthorBiographyInTOC}%
\settoggle{AuthorBiographyInTOC}{false}%

\define@boolkey{authorbio}{totoc}[false]{%
  \ifKV@authorbio@totoc
  \toggletrue{AuthorBiographyInTOC}
  \else
  \togglefalse{AuthorBiographyInTOC}
  \fi
}%


\newcommand{\listofauthorbiographiesname}{List of Author Biographies}

\newlistof{authorbiographies}{bio}{\listofauthorbiographiesname}

\presetkeys{authorbio}{imagepos=l,imagewidth=4cm,wraplines=15,overhang=20pt,totoc=false}{}%

\newcommand*{\authorbiography@@singlename}{Biography of author}%
\newcommand*{\authorbiography@@name}{Biographies of authors}%



\DeclareExpandableDocumentCommand{\authorbiographyname}{+m}{%
  \IfNoValueTF{#1}{%
    \authorbiography@@name%
  }{%
    \ifnumgreater{#1}{1}{%
      \authorbiography@@name}{%
      \ifnumequal{#1}{1}{%
        \authorbiography@@singlename%
      }{}%
    }%
  }%
}%



\NewDocumentCommand{\Authorbiography}{+o}
{%
  \immediate\closeout\authorbibfile%
  \csundef{AuthorbioKVMacroBiographyName}%
  \clearpage
  \ifnumgreater{\value{authorbiographies}}{0}{% Only add a page/entries if the authorbiographies counter is greater than 0
    \IfValueTF{#1}{%
      \setkeys*{authorbio}{#1}%
      \iftoggle{AuthorBiographyInTOC}{%
        \ifcsdef{AuthorbioKVMacroBiographyName}{%
          \ifcsdef{chapter}{%
            \chapter*{\AuthorbioKVMacroBiographyName}% %Check for KOMA addchap etc later on.
            \markboth{\AuthorbioKVMacroBiographyName}{\AuthorbioKVMacroBiographyName}%
            \addcontentsline{toc}{chapter}{\AuthorbioKVMacroBiographyName}%
          }{%
            \section*{\AuthorbioKVMacroBiographyName}%   
            \markboth{\AuthorbioKVMacroBiographyName}{\AuthorbioKVMacroBiographyName}
            \addcontentsline{toc}{section}{\AuthorbioKVMacroBiographyName}%
          }%
        }{%
          \ifcsdef{chapter}{%
            \chapter*{\authorbiographyname{\number\value{authorbiographies}}}%
            \addcontentsline{toc}{chapter}{\authorbiographyname{\number\value{authorbiographies}}}%
          }{% Assume that \section* exists ;-)
            \section*{\authorbiographyname{\number\value{authorbiographies}}}%
            \addcontentsline{toc}{section}{\authorbiographyname{\number\value{authorbiographies}}}
          }%
          \markboth{\authorbiographyname{\number\value{authorbiographies}}}{\authorbiographyname{\number\value{authorbiographies}}}%
        }%
      }{}%
    }{% No further ado, just add a (chapter) header to the page
      \ifcsdef{chapter}{%
        \chapter*{\authorbiographyname{\number\value{authorbiographies}}}%
      }{% Assume that \section* exists ;-)
        \section*{\authorbiographyname{\number\value{authorbiographies}}}%
      }%
      \markboth{\authorbiographyname{\number\value{authorbiographies}}}{\authorbiographyname{\number\value{authorbiographies}}}%
    }%
    \InputIfFileExists{\jobname.aub}{\typeout{authorbiographies: Inputting file successfully}}{\typeout{Error: File \jobname.aub does not exist}}%
  }% End of \ifnumgreater...
}%



\NewDocumentCommand{\authorbiographyyearofdeathstyle}{+o}{%
  \textbf{\textdied #1)}%
}%

\NewDocumentCommand{\authorbiographyyearofbirthstyle}{+o}{%
  \textbf{(\textborn #1}%
}%


\NewDocumentCommand{\writeauthorlifeinfo}{+o}{%
  \global\undef\AuthorbioKVMacroYearofbirth%
  \global\undef\AuthorbioKVMacroYearofdeath%
  \IfValueTF{#1}{%
    \setkeys*{authorbio}{#1}%
    \ifcsdef{AuthorbioKVMacroYearofbirth}{%
      \authorbiographyyearofbirthstyle[\AuthorbioKVMacroYearofbirth]%
      \ifcsdef{AuthorbioKVMacroYearofdeath}{%
        , \authorbiographyyearofdeathstyle[\AuthorbioKVMacroYearofdeath]%
      }{%
        \textbf{)} % No year of death given ...unknown or still alive
      }%
    }{% No year of birth give, but perhaps a year of death?
      \ifcsdef{AuthorbioKVMacroYearofdeath}{%
        (\textborn ? , \authorbiographyyearofdeathstyle[\AuthorbioKVMacroYearofdeath]%
      }{%
        % Do nothing
      }%
    }%
  }{% No argument given, do nothing
  }%
}%



\NewDocumentCommand{\authorbiography}{+o+m+m+m}{%
  \csundef{AuthorbioKVMacroWraplines}%
  \setkeys*{authorbio}{#1}%
  \IfNoValueTF{#3}{%
    \typeout{Warning: No author name}%  Needs improvement
  }{%
    \refstepcounter{authorbiographies}%
    \addcontentsline{bio}{section}{\protect{#3}}% Should be improved!
    \immediate\write\authorbibfile{%
      \string\begin{tcolorbox}[floatplacement=htp,float,boxrule=0pt,boxsep=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,arc=0mm,auto outer arc,width=\textwidth]%
%      \string\vskip\AuthorbioTopSkip%
      \string\begin{wrapfigure}[\AuthorbioKVMacroWraplines]{\AuthorbioKVMacroImagepos}[\AuthorbioKVMacroOverhang]{\AuthorbioKVMacroImagewidth}%
        \string\centering%
        \string\includegraphics\expandafter[\XKV@rm]{#2}% Use the \XKV@rm macro for possible remaining macros designed only for \includegraphics 
        \string\end{wrapfigure}%
      \unexpanded{\noindent}%
      \unexpanded{\textbf{#3}}%
      \writeauthorlifeinfo[#1]%
      \string\par^^J
      \string\noindent^^J%
      \unexpanded{#4}%
 %     \string\vskip\AuthorbioBottomSkip%
      \string\end{tcolorbox}%
    }%
  }%
}%



\endinput%

driver file

\documentclass{scrbook}

\usepackage{authorbiography}%

\usepackage{hyperref}%
\usepackage{blindtext}%


\begin{document}%

\tableofcontents
\clearpage
\listofauthorbiographies
\section{Normal Content}
\blindtext




\authorbiography[scale=0.3,overhang=0pt,wraplines=9,imagewidth=3cm,imagepos=l,yearofbirth={1887},yearofdeath={1961}]{bild_erwin_schroedinger}{Erwin Schr\"odinger}{\blindtext}%

\authorbiography[scale=0.3,wraplines=10,overhang=0pt,imagewidth=5cm,imagepos=r,yearofbirth={1564},yearofdeath={1616}]{CHANDOS3}{William Shakespeare}{\blindtext}%

\authorbiography[scale=0.2,width={4cm},imagewidth=6cm,wraplines=15,imagepos=l,overhang=0pt,yearofbirth={1879},yearofdeath={1955}]{einstein.jpg}{Albert Einstein}{\blindtext}%

\authorbiography[scale=0.1,imagewidth=3cm,wraplines=10,imagepos=r,overhang=0pt,yearofbirth={1879},yearofdeath={1955}]{einstein.jpg}{Albert Einstein}{\blindtext}%

\authorbiography[scale=0.1,imagewidth=3cm,wraplines=10,imagepos=r,overhang=0pt,yearofbirth={1879}]{einstein.jpg}{Albert Einstein}{\blindtext}%


\Authorbiography% Standard behaviour


\Authorbiography[totoc=true,BiographyName={Authors}] % Use some more configurability



\end{document}

enter image description here

Some notes on this 'package'...

It requires still some manual tweaking about the wrapfig parameters, this is not automatically done, the floating works nice, but the last one is not at the top, so this is ... well, bad.

There are many improvements and ideas possible, I will come back to it.