I want to set hyperref to use my custom command for title & author.
\documentclass{article} % or report or book
\makeatletter
\newcommand{\titlul}[1]{%
\newcommand{@titlul}{#1}
}
\newcommand{\autor}[1]{%
\newcommand{@autor}{#1}
}
\newcommand{\dotitle}{%
\begingroup
\thispagestyle{empty}%
\centering
\vspace*{1cm}
\ifcsname @titlul\endcsname
{\Large\bfseries\sffamily @titlul\par}\smallskip
\fi
\ifcsname @autor\endcsname
{\large\sffamily @autor\par}\vspace{.1cm}
\fi
\vspace{1cm}
\endgroup
}
\makeatother
\usepackage{hyperref}
\makeatletter
\hypersetup{pdftitle={@titlul},pdfauthor={@autor}}
% error
% Undefined control sequence.
% <argument> @titlul
% l.40 ...tup{pdftitle={@titlul},pdfauthor={@autor}}
% https://tex.stackexchange.com/questions/17218/make-hyperref-take-pdfinfo-from-title-and-author
\makeatother
\titlul{Title here}
\autor{Author here}
\date{\today}
% start document
\begin{document}
\dotitle
\end{document}

