我面临以下问题。我在 LaTex 中使用了一个序言,这是我大学特定类型的文档所需要的。但是,我无法在另一台笔记本电脑上使用完全相同的代码。我将 MiKTeX 与 TeXstudio 一起使用。我多次卸载并安装了它们,并尝试使用 TeXlive 中的代码,但无济于事。我甚至用 Ubuntu 设置了一个虚拟机来确定错误是否是 Windows 问题。不,不是。我收到了完全相同的错误消息。我有多个朋友使用与序言相同的代码,并且没有问题,就像我在旧笔记本电脑上一样。错误是:
“命令 \ifpdftex 已定义。}”
我认为我使用的软件包大部分都发生了变化,因此只有旧版本可以工作(我们所有人都在使用,因为我们 6 个月前安装了它)。错误似乎出现在 pdfcprot.sty 的第 703 行,我无法删除它,因为它显然是必需的。我对这个主题很陌生,真的不明白我的错误。这是我的序言:
\documentclass[
a4paper,
12pt,
twoside,
headsepline,
footsepline,
captions=tableheading,
numbers=endperiod,
]{scrartcl}
\brokenpenalty=10000
%\usepackage[style=chem-acs]{biblatex}
\usepackage{floatrow}
\floatsetup[table]{style=plaintop}
\floatsetup[longtable]{LTcapwidth=table}
\usepackage{siunitx}
\sisetup{exponent-product = \cdot, output-product = \cdot, separate-uncertainty=true}
\usepackage[ngerman]{babel}
\usepackage{grffile}
\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{chemfig}
\definesubmol\nobond{-[3,0.2,,,draw=none]}
\usepackage{pgfplots}
\usetikzlibrary{babel}
\usepackage{amsmath}
\usepackage{calc}
\usepackage{FP}
\usepackage{placeins}
\usepackage{pgfplotstable}
\usepackage{verbatim}
% recommended:
\usepackage{booktabs}
\setlength\heavyrulewidth{0.4pt} %Dicke der Linien am Anfang und Ende jeder Tabelle
\setlength\lightrulewidth{0.4pt} %Dicke der Linien nach header
\usepackage{array}
\usepackage{colortbl}
\usepackage{csvsimple}
\usepackage{amssymb}
\usepackage{longtable}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{ae}
\usepackage[activate]{pdfcprot}
\usepackage{setspace}
\usepackage{fontspec}
%\usepackage[utf8]{inputenc}
\usepackage{scrlayer-scrpage}
\usepackage{mhchem}
\usepackage{subcaption}
\usepackage{caption}
\captionsetup{labelfont={bf,it},tablename=Tab.,figurename=Abb.}
\captionsetup[table]{singlelinecheck=false,justification=justified}
\captionsetup[figure]{justification=justified}
%\usepackage[nolist]{acronym} Acronymverzeichnis
\usepackage{svg}
\renewcommand*\figureformat {\figurename~\arabic{section}.\arabic{subsection}.\thefigure.}
\renewcommand*\tableformat {\tablename~\arabic{section}.\arabic{subsection}.\thetable:}
\renewcommand*\captionformat {~}
\pgfplotstableset{
every head row/.style={before row=\toprule,after row=\midrule[0.4pt]},
every last row/.style={after row=\bottomrule}}
\let\oldcite\cite
\renewcommand*\cite[1]{\textsuperscript{\oldcite{#1}}}
\sisetup{group-digits=true,
group-four-digits=true,
group-separator = {\,},
output-decimal-marker = {.}}
\pgfplotsset{
siunitxlabels/.style={
/pgfplots/typeset ticklabel/.code={\pgfmathparse{\tick}$\num[zero-decimal-to-integer]{\pgfmathresult}$},
},
}
\makeatletter
\renewcommand*\bib@heading{\subsubsection{\bibname}
\@mkboth{\subsubsectionmarkformat \bibname}{\subsubsectionmarkformat \bibname}}
\makeatother
\addto\captionsngerman{\renewcommand*\bibname{Literatur}}
\usepackage{prettyref} x.x.# anpassen
%%% Für Abbildungen %%%
\newrefformat{fig}{Abb.~\arabic{section}.\arabic{subsection}.\ref{#1}}
%%% Für Tabellen %%%
\newrefformat{tab}{Tab.~\arabic{section}.\arabic{subsection}.\ref{#1}}
%%% Für Formeln
\newrefformat{eq}{Gl.~\arabic{section}.\arabic{subsection}.\ref{#1}}
%%% Für chem. Formeln
\newrefformat{ceq}{Gl.~\ref{#1}}
\usepackage[
linkcolor=black,
citecolor=black,
urlcolor=black,
colorlinks=true,
]{hyperref}
%\renewcommand\citeform[1]{[#1]}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\Large\bfseries}{\arabic{section}.}{1.5em}{}
\titleformat{\subsection}
{\normalfont\LARGE\bfseries}{\arabic{section}.\arabic{subsection}.}{1.2em}{}
\titleformat{\subsubsection}
{\normalfont\Large\bfseries}{\arabic{section}.\arabic{subsection}.\arabic{subsubsection}.}{0.75em}{}
\setkomafont{sectioning}{\bfseries} %Serifenschrift in Überschriften
\setkomafont{section}{\LARGE}
\setkomafont{subsection}{\LARGE}
\setkomafont{subsubsection}{\large}
\pagenumbering{arabic}
\geometry{left=3cm, right=2cm, top=2.5cm, bottom=2cm}
\parindent 0pt
\setlength{\parindent}{0pt}
\parskip 12pt
\onehalfspacing
\pagestyle{scrheadings}
\headsep0.4cm
\footskip0.8cm
\urlstyle{same}
\RedeclareSectionCommand[
%runin=false,
afterindent=false,
beforeskip=\baselineskip,
afterskip=.5\baselineskip]{section}
\RedeclareSectionCommand[
%runin=false,
afterindent=false,
beforeskip=.75\baselineskip,
afterskip=.5\baselineskip]{subsection}
\RedeclareSectionCommand[
%runin=false,
afterindent=false,
beforeskip=.5\baselineskip,
afterskip=.25\baselineskip]{subsubsection}
我将非常感激您的帮助。谢谢!
此致