2

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},
    version={3.0}]{doclicense}
\usepackage{fancyhdr}

\fancypagestyle{logo}{
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[LE,RO]{ \resizebox{0.4\textwitdh}{!}{\doclicenseThis} }
}

\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}
]{doclicense}
\usepackage{background}

\backgroundsetup{contents={\doclicenseThis}}

\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?

2

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:

enter image description here

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

\makeatletter
\fancypagestyle{logo}{%
  \fancyhf{}%
  \renewcommand{\headrulewidth}{0pt}%
  \fancyfoot[LE,RO]{%
    \begin{minipage}{0.5\textwidth}%
      \def\doclicense@imagewidth{2cm}%
      \tiny
      \doclicenseThis
    \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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.