# Issues with doclicense, both with fancyhdr and with background

This is an attempt to insert the doclicense output in each page of a document, using fancyhdr:

\documentclass[12pt]{article}
\usepackage[
type={CC},
modifier={by-sa},
\usepackage{fancyhdr}

\fancypagestyle{logo}{
\fancyhf{}
}

\pagestyle{logo}

\begin{document}

Some text.

\newpage

Some new text.

\end{document}


This code doesn't work, generating occurrences of this error

Something's wrong--perhaps a missing \item. \newpage


at \newpage, and several occurrences of this error

Something's wrong--perhaps a missing \item. \end{document}


at the end, also simply using \doclicenseThis instead of the resizebox. Other errors are:

Undefined control sequence. \end{document}
Illegal unit of measure (pt inserted). \end{document}
\fancyfoot's E' option without twoside option is useless


This is similar to what happens with package background:

\documentclass[12pt]{article}
\usepackage[
type={CC},
modifier={by-sa},
version={3.0}
\usepackage{background}

\begin{document}

Some text.

\newpage

Some new text.

\end{document}


which generates several times

Something's wrong--perhaps a missing \item.


at \newpage and at the end of document.

What could it be the problem and how to fix this?

The \doclicenseThis macro contains a center environment, which breaks inside an \hbox (\resizebox is an \hbox with a few more fancies around).

If you try:

\resizebox{1cm}{!}{%
\begin{center}
D'oh
\end{center}
}


you'll get the same error.

The issue with background is the same. The contents of the background are inserted with a TikZ \node, which is another fancy \hbox, thus it will fail as well:

\tikz\node{%
\begin{center}
D'oh
\end{center}%
};


but this one is much trickier to work around, so below I go for the solution using fancyhdr.

Besides redefining the \doclicenseThis, you can put it in a minipage instead of a \resizebox. With a few hand-tuning of the sizes you get:

\documentclass[12pt]{article}
\usepackage[
type={CC},
modifier={by-sa},
\usepackage{fancyhdr}

\makeatletter
\fancypagestyle{logo}{%
\fancyhf{}%
\fancyfoot[LE,RO]{%
\begin{minipage}{0.5\textwidth}%
\tiny
\end{minipage}%
}%
}
\makeatother

\pagestyle{logo}

\begin{document}

Some text.

\newpage

Some new text.

\end{document}

• Thank you so much. It is more than enough to use only fancyhdr`. – BowPark Dec 5 '18 at 10:00