4

I know, there is this question but my knowledge regarding .cls files when it comes to latex, is too little. I tried to do as the solution there says there but I don't use begincmd so I don't know how to apply it to my case.

The error message causing the issue:

(./main.aux)
! Undefined control sequence.
\set@color ...\@pdfcolorstack push{\current@color 
                                                  }\aftergroup \reset@color 
l.41 \begin{document}
                     
? 

Here the part of .cls file using color:

\AtBeginDocument
    {
    \hypersetup{
        pdftitle = {\inserttitle},
        pdfauthor = {\insertauthor},
        pdfsubject = {\insertsubject},
        pdfkeywords = {PI4 Template v1.6},
        citebordercolor = {.36 .93 0},
        linkbordercolor = {1 .6 .33},
        menubordercolor = {1 .6 .33},
        urlbordercolor = {.39 .82 1},
        pdfborder = {0 0 .5}
    }

here the entire .cls file

% Basic class options
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesClass{pi4-thesis}[2015/12/17 PI4 Thesis Template V1.6]

% Option for language selection.
\let\if@langgerman\iffalse
\DeclareOption{german}{\let\if@langgerman\iftrue}

% Pass otions that are not specified above to the base class.
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrbook}}

\ProcessOptions

% Load base class.
\LoadClass[a4paper,
           toc=listof,
           toc=bib,
           11pt,
           DIV=10
           ]{scrbook}

% UTF-8 should be supported by all major editors. If this causes problem change it to another
% encoding (e.g., 'latin1').
\RequirePackage[utf8]{inputenc}
% ---------------------------------

% Title page details
\newcommand{\piivsubject}[1]{\newcommand{\insertsubject}{#1}}
\newcommand{\piivtitle}[1]{\newcommand{\inserttitle}{#1}}
\newcommand{\piivauthor}[1]{\newcommand{\insertauthor}{#1}}
\newcommand{\piivsupervisor}[1]{\newcommand{\insertsupervisor}{#1}}
% ---------------------------------

% Language selection
\if@langgerman
    \RequirePackage[main=ngerman,english]{babel}
    \babeltags{lang-main = ngerman}

    \newcommand{\insertcitydate}[2]{#1, den #2}

    \bibliographystyle{dinat}
\else
    \RequirePackage[main=english,ngerman]{babel}
    \babeltags{lang-main = english}

    \newcommand{\abstractchap}{\addchap{Abstract}}
    \newcommand{\declarationofhonorchap}{\chapter{Declaration of Honour}}
    \newcommand{\insertsupervisordetails}{Supervisor: \insertsupervisor}
    \newcommand{\insertinstitution}{institution}
    \newcommand{\insertauthordetails}{\vspace{0.2cm}
    \insertauthor}

    \newcommand{\insertcitydate}[2]{#1, #2}

    \bibliographystyle{abbrvnat}
\fi

\babeltags{lang-de = ngerman}
\babeltags{lang-en = english}
% ---------------------------------

% Package includes
%
% The following list of packages should provide you a more or less complete basis for your thesis.
% However, it might be required that you change some package options or include new ones. For each
% of the used package a very brief description is given. If you like to know more on a specific
% package I recommend that you read the package documentation at http://www.ctan.org/pkg/ (just
% search for the package name). Of course you also can include more packages if you need them.
%
% Nicer fonts for your document.
\RequirePackage[T1]{fontenc}
\RequirePackage{libertine}
% http://www.khirevich.com/latex/microtype/
\RequirePackage[activate={true,nocompatibility},
                final,
                tracking=true,
                kerning=true,
                spacing=true,
                factor=1100,
                stretch=10,
                shrink=10]{microtype}
\RequirePackage{ellipsis}
% Responsible for the style of bibliography and citations.
\RequirePackage[round,
                sort&compress]{natbib}
% Brings color to your document.
\RequirePackage[usenames,
                dvipsnames,
                table]{xcolor}
% Better formatting of URLs in the text.
\RequirePackage[hyphens]{url}
% Provides functions for better hyphenation of words.
\RequirePackage{hyphenat}
% Produces clickable links within the PDF file.
\RequirePackage[pdftex,
            unicode=true,
            bookmarks=true,
            hyperfootnotes=false
            ]{hyperref}
% Provides support for including images in your document.
\RequirePackage{graphicx}
% Support for multiple images in one figure environment.
\RequirePackage{subfig}
% More options for tabular envrionments.
\RequirePackage{array}
\RequirePackage{tabu}
\RequirePackage{longtable}
\RequirePackage{booktabs}
% Support for listings (for displaying algorithms, source code, etc.).
\RequirePackage{listings}
% Provides todo notes that help you keep track of what you have to do.
\RequirePackage{todonotes}
% Produces nonsense text. Can be removed as soon as you started writing your own text.
\RequirePackage{blindtext}
% Provides the glossary function.
\RequirePackage[toc,
                acronyms,
                automake=true,
                numberedsection=nameref,
                translate=babel]{glossaries}
% Some small improvements for the KOMA script packages.
\RequirePackage{scrhack}
% Allows you to rotate a page correctly in the PDF.
\RequirePackage{pdfpages}
% A more intelligent reference system
\RequirePackage{cleveref}
% ---------------------------------

% Language options for specific packages
\if@langgerman
    \renewcommand{\lstlistlistingname}{Auflistungsverzeichnis}
    \renewcommand{\lstlistingname}{Auflistung}
    \renewcommand{\acronymname}{Abkürzungsverzeichnis}
\else
    \renewcommand{\lstlistlistingname}{List of Listings}
    \microtypecontext{spacing=nonfrench}
\fi
% ---------------------------------

% Layout tweaks
%
% Schusterjungen und Hurenkinder verhindern. Siehe deutsches TeX-FAQ (6.1.3)
\clubpenalty = 10000
\widowpenalty = 10000
\displaywidowpenalty = 10000
% ---------------------------------

% Title page
\title{\textnormal{\textsc{\Large \insertsubject}}\\
\vspace{0.4cm}
\inserttitle}
\author{\insertauthordetails}
\publishers{\insertsupervisordetails\\
\vspace{1cm}
\insertinstitution}
% ---------------------------------

% Adaptions for the actual document
\AtBeginDocument
{
\hypersetup{
    pdftitle = {\inserttitle},
    pdfauthor = {\insertauthor},
    pdfsubject = {\insertsubject},
    pdfkeywords = {PI4 Template v1.6},
    citebordercolor = {.36 .93 0},
    linkbordercolor = {1 .6 .33},
    menubordercolor = {1 .6 .33},
    urlbordercolor = {.39 .82 1},
    pdfborder = {0 0 .5}
}

\setlength{\parindent}{15pt}

\frontmatter
\maketitle
}
% ---------------------------------

and the main.tex:

\documentclass[oneside]{pi4-thesis}
% Choose between bachelor thesis or master thesis.
\piivsubject{stuff \texorpdfstring{\\
more \\
stuff}{}}
% The title of your work.
\piivtitle{title}
% Your name.
\piivauthor{Me}
% Name of your supervisor.
\piivsupervisor{Dr. X}
% The date you submit your thesis. You can substitute the command with any date.
\date{\today}

% If you want to use the glossary make sure your 'makeindex' toolchain is working correctly.
% Alternetively, you might want to look into the 'xindy' option of the glossaries package.
\makeglossaries

\begin{document}
%\input{src/glossary}

% ---------------------------------
% Begin of abstract
\abstractchap
% \blindtext creates a paragraph of non-sense text. Replace it with your actual content.
\blindtext
% End of abstract
% ---------------------------------

% ---------------------------------
% Begin of listings
\microtypesetup{protrusion=false} % disables protrusion locally in the document
\tableofcontents
% If you should not have any figures, tables or acronyms in your paper remove the according list.
%\listoffigures
%\listoftables
% Uncomment the next line if you use listings in your document.
% \lstlistoflistings
\microtypesetup{protrusion=true} % enables protrusion

\printglossary[type=\acronymtype]
% End of listings
% ---------------------------------

% ---------------------------------
% Begin of main part
\mainmatter

%\input{src/chapter_1} 

%\input{src/chapter_2}

%\input{src/chapter_3}

% End of main part
% ---------------------------------

% ---------------------------------
% Begin of appendix
\appendix
% Appendix chapters are optional. Use it if you have very long tables or additional figures that
% do not belong to the main text.
%\input{src/appendix}

% Remove this from the final document
%\input{src/checklist}

\backmatter

\bibliography{library}

% Fix for long URLs in bibliography
\sloppy
\printglossary
\fussy
   
% End of appendix
% ---------------------------------

\end{document}
3
  • we can not run this example it is far from minimal and inputs multiple files you have not supplied, and you have not shown the original formatting of the error message so it is hard to tell which command is undefined (presumably \current@color} please make a small but complete example that shows the problem. Commented Dec 20, 2020 at 16:53
  • 1
    Thanks for pointing it out! Now it should work.
    – topkek
    Commented Dec 20, 2020 at 17:59
  • 5
    I have the same problem. The minimal example is \documentclass{dinbrief} \usepackage{tikz} \begin{document} hello world! \end{document} with LuaHBTeX, Version 1.12.0 on current Debian Bullseye
    – hpod
    Commented Dec 25, 2020 at 11:01

1 Answer 1

4

Your class is trying to typeset the title in \AtBeginDocument. This is not a good idea.

If you have a current latex (with a format 2020-10-01) you can declare a rule to move the code to another place:

\makeglossaries
\DeclareHookRule{begindocument}{pi4-thesis}{after}{cleveref}
\begin{document}

This isn't perfect either, but at least the color is now correctly setup.

1
  • This didn't work for me so I had to use this. Commented May 14 at 8:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .