How do I insert the title in the footer? And decide if it is set or not?
%preteste.sty
\usepackage{fancyhdr}
\usepackage{lipsum}
\renewcommand{\title}[1]{\gdef\@title{#1}\gdef\mytitle{#1}}
\newcommand{\mytitle}{%
\PackageErrorNoLine{pkgname}
{No \protect\title\space given}
{You have to provide a title}%
\gdef\mytitle{You have to provide a title}%
\mytitle
}
\fancyfoot{}
\fancyfoot[C]{\mytitle}
See the error if no define \title
and no use \maketitle
%titulo.tex
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{preteste}
% \title{Title}
% \author{R\'egis S. Santos}
% \date{\the\year}
\begin{document}
\pagestyle{fancy}
% \maketitle
\lipsum
\end{document}
fix my code, please.