2

I have a longer work and in that I want include a pdf-file and also I have customize enumerate-items with package enumitem. With inculded package pdfpages I get errors.

Is it possible to include pdfpages and to keep my customization with enumitem? Minimal working example below.

\documentclass{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{enumitem}

% um PDF-Dateien einbinden zu können ---------------------------------------------------------------
\usepackage{pdfpages}

% Tabellen -----------------------------------------------------------------------------------------
\usepackage{booktabs}                   % horizontale Linien in Tabellen
\usepackage{longtable}                  % lange Tabellen
\usepackage{ragged2e,array}             % für Ausrichtung der Tabellen(-spalten/-zellen)

% Programmierung der Auflistung der Interviewitems -------------------------------------------------
\newcounter{Kategorie}
\setcounter{Kategorie}{0}
\newcounter{Frage}
\setcounter{Frage}{1}

\newcommand{\KategoriePlus}{%
  \addtocounter{Kategorie}{1}%
  [\Alph{Kategorie}]%
  \setcounter{Frage}{1}%
}

\newcommand{\FragePlus}{%
  \theFrage%
  \addtocounter{Frage}{1}%
}

\usepackage{blindtext}

\begin{document}

\chapter{Einleitung}

\blindtext[3]

\chapter{Anhang}

\renewcommand{\arraystretch}{2}
\begin{longtable}[l]{>{\RaggedRight}p{5.75cm}>{\RaggedRight}p{10.25cm}} \toprule

Inhalt & Frage \\ \midrule
\multicolumn{2}{l}{\begin{minipage}[t]{16cm}
\bfseries \begin{enumerate}[label=\KategoriePlus] \item Allgemeine Daten \end{enumerate} \end{minipage}} \\
Soziodemografische Daten der Versuchsperson &
\begin{minipage}[t]{10cm} \begin{enumerate}[label=\Alph{Kategorie}.\FragePlus]
\item Alter
\item Geschlecht
\item Schulabschluss
\end{enumerate} \end{minipage} \\ \bottomrule

\end{longtable}

\end{document}
5

Package pdfpages loads package calc that makes \setcounter and \addtocounter more fragile, especially if they are used inside option label of package enumitem's redefined environment enumerate.

The best solution would be to avoid the counter assignments in label. because this option is intended for formatting the label and nothing else. If a later version of enumitem would call the code of \label twice per \item, then it would also disturb the counter assignments.

Thus the following is only a crude hack, using robust counter assignments, but not curing the underlying problem:

\newcommand{\KategoriePlus}{%
  % \stepcounter{Kategorie}%
  \global\advance\value{Kategorie} by 1\relax
  [\Alph{Kategorie}]%
  % \setcounter{Frage}{1}%
  \global\value{Frage}=1\relax
}

\newcommand{\FragePlus}{%
  \theFrage
  % \stepcounter{Frage}%
  \global\advance\value{Frage} by 1\relax
}

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.