Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Ant0in8
Posts: 5 Joined: Wed Oct 03, 2012 6:29 pm
Post
by Ant0in8 » Wed Oct 29, 2014 11:29 am
Hi! I am trying to modify maketitle using the package authblk. But it doesn't work until now, and I cannot manage to find the reason(s). Thanks in advance for your help.
Code: Select all
\documentclass{article}
\makeatletter
\usepackage{hyperref}
\usepackage{authblk}
\newcommand{\address}[1]{\newcommand{\@address}{#1}}
\newcommand{\institute}[1]{\newcommand{\@institute}{#1}}
\renewcommand{\maketitle}{
{\LARGE\noindent\ignorespaces\@title\par}
{\Large\noindent\ignorespaces\@author\par}
{\normalsize\noindent\ignorespaces\@affil\par}
{\normalsize\noindent\ignorespaces\@institute\par}
{\normalsize\noindent\ignorespaces\@address\par}
{\normalsize\noindent\ignorespaces\@date\par}
}
\begin{document}
\title{Draft in progress}
\author[a]{authorA}
\author[b]{authorB}
\affil[a]{\href{mailto:authorA@email.com}{authorA@email.com}}
\affil[b]{\href{mailto:authorB@email.com}{authorB@email.com}}
\institute{University}
\address{earth}
\date{\today}
\maketitle
(blablabla)
\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.
Johannes_B
Site Moderator
Posts: 4182 Joined: Thu Nov 01, 2012 4:08 pm
Post
by Johannes_B » Wed Oct 29, 2014 5:43 pm
\affil
takes two arguments and the definition behind is much more complicated than for author or title of the standard article class. Package authblk takes all the author and affiliation information, packs it together and
def
's
\@author
.
Simply try the following:
Code: Select all
\documentclass{article}
\usepackage{authblk}
\makeatletter
\newcommand{\address}[1]{\newcommand{\@address}{#1}}
\newcommand{\institute}[1]{\newcommand{\@institute}{#1}}
\renewcommand{\maketitle}{
{\LARGE\noindent\ignorespaces\@title\par}
{\Large\noindent\ignorespaces\@author\par}
% {\normalsize\noindent\ignorespaces\@affil\par}
{\normalsize\noindent\ignorespaces\@institute\par}
{\normalsize\noindent\ignorespaces\@address\par}
{\normalsize\noindent\ignorespaces\@date\par}
}
\makeatother
\renewcommand{\Affilfont}{\normalsize}
\usepackage{hyperref}%usually loaded last
\begin{document}
\title{Draft in progress}
\author[a]{authorA}
\author[b]{authorB}
\affil[a]{\href{mailto:authorA@email.com}{authorA@email.com}}
\affil[b]{\href{mailto:authorB@email.com}{authorB@email.com}}
\institute{University}
\address{earth}
\date{\today}
\maketitle
(blablabla)
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Ant0in8
Posts: 5 Joined: Wed Oct 03, 2012 6:29 pm
Post
by Ant0in8 » Wed Oct 29, 2014 8:53 pm
thanks, it works! I have an other question, if I want that the affils appear after institute, how should I do? I tried the very naive thing to just write the two \affil after \institute, but it doesn't work. thank you in advance.
Johannes_B
Site Moderator
Posts: 4182 Joined: Thu Nov 01, 2012 4:08 pm
Post
by Johannes_B » Wed Oct 29, 2014 9:04 pm
As said before, the author and affil information are packed together in \@author. You would need patch the original authblk commands. But look at the file, it is a mess.
If the package is actively maintained, you could ask for some feature request. But since institute isn't a native command ...
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Ant0in8
Posts: 5 Joined: Wed Oct 03, 2012 6:29 pm
Post
by Ant0in8 » Wed Oct 29, 2014 9:05 pm
ok, thanks a lot for your help!
Johannes_B
Site Moderator
Posts: 4182 Joined: Thu Nov 01, 2012 4:08 pm
Post
by Johannes_B » Thu Oct 30, 2014 10:06 am
You can do something like the following, but to be quite honest, i don't know why you are using authblk. If you would be a bit more verbose about your goals, we could find another solution.
Code: Select all
\documentclass{article}
\makeatletter
\usepackage{authblk}
\makeatletter
\newcommand{\address}[1]{\newcommand{\@address}{#1}}
\newcommand{\institute}[1]{\newcommand{\@institute}{#1}}
\renewcommand{\maketitle}{
{\LARGE\noindent\ignorespaces\@title\par}
{\Large\noindent\ignorespaces\@author\par}
% {\normalsize\noindent\ignorespaces\@affil\par}
{\normalsize\noindent\ignorespaces\@institute\par}
{\normalsize\noindent\ignorespaces\@address\par}
{\normalsize\noindent\ignorespaces\@date\par}
}
\newcommand\institutefont{\normalsize}
\renewcommand{\Affilfont}{\normalsize}
\renewcommand\@author{\ifx\AB@affillist\AB@empty\AB@author\else
\ifnum\value{affil}>\value{Maxaffil}\def\rlap##1{##1}%
\AB@authlist\\{\institutefont\@institute}\\[\affilsep]\AB@affillist
\else \AB@authors\fi\fi}
\makeatother
\usepackage{hyperref}%usually loaded last
\begin{document}
\title{Draft in progress}
\author[a]{authorA}
\author[b]{authorB}
\affil[a]{\href{mailto:authorA@email.com}{authorA@email.com}}
\affil[b]{\href{mailto:authorB@email.com}{authorB@email.com}}
\institute{University}
\address{earth}
\date{\today}
\maketitle
(blablabla)
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.