scrlayer-scrpage に関するコンパイル エラー

scrlayer-scrpage に関するコンパイル エラー

私の質問の1つに対する解決策は、それを提供した人にはうまく機能しましたが、コンパイル中に「Missing \begin{document}. \ofoot*{\pagemark」というエラーが発生します。これは私のインストール、パッケージ、OSに問題があるのでしょうか? これについてオンライン LaTeX コンパイラ同じエラーにより出力が生成されないので、問題はないかもしれませんが、コードを変更する必要があるのでしょうか?

\documentclass[12pt,a4paper,listof=flat,oneside]{scrartcl}
\KOMAoptions{captions=tableheading}
\usepackage{nicefrac}
\usepackage{scrlayer-scrpage}
\ihead{\headmark}
\chead*{}
\ofoot*{\pagemark}
\cfoot*{}
\pagestyle{scrheadings}
\automark[section]{section}
\setkomafont{pagehead}{\normalfont}
\KOMAoptions{
    captions=tableheading,
    headsepline=true,
    markcase=upper}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} 
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{xfrac}
\usepackage{xspace}
\newcommand{\eg}{\mbox{e.\,g.}\xspace}
\newcommand{\Eg}{\mbox{E.\,g.}\xspace}
\usepackage[english]{babel} 
\usepackage[left=3.00cm, right=3.00cm, top=2.00cm, bottom=2.5cm, includeheadfoot]{geometry} 
\usepackage[onehalfspacing]{setspace} 
\usepackage{lmodern}
%\usepackage{helvet}
%\renewcommand{\familydefault}{\sfdefault} 
%\fontfamily{phv}\selectfont
\usepackage{color}
\usepackage[
  pdftoolbar = false,
  pdfmenubar = false, 
  pdftitle   = mwe,
  pdfauthor  = {author},
  colorlinks,
  allcolors =  {blue},
  bookmarks         = true,
  bookmarksopen     = true, 
  bookmarksnumbered = true
]{hyperref}
\usepackage{subcaption}

\begin{document} \thispagestyle{plain.scrheadings} \section{Chapter one} \label{sec:ChapterOne} This text shows the current options that I have used for the printed version of my document. What and why would you change something? \begin{itemize} \item Referencing in blue. \Eg: Chapter one on page \ref{sec:ChapterOne} \item In-text math mode I use tfrac or nicefrac like this $\tfrac{1}{2}$ or this $\nicefrac{1}{2}$ and dfrac in the stand-alone equations. Or is sfrac of the xfrac package the way to go? $\sfrac{1}{2}$. What is the difference? \item Different fonts for print-out and digital copy? \Eg helvet for pdf for no serifs? \end{itemize} \newpage Thats what the pagestyle I have choosed looks like, but there is a warning about fancyhdr, how to produce the same output with KOMA?

\begin{figure}[!htbp] \null\hfill \begin{minipage}[b]{0.4\linewidth} \centering \includegraphics[width=\textwidth]{example-image-a} \subcaption{Example A}\label{fig:a} \end{minipage} \hfill \begin{minipage}[b]{0.4\linewidth} \centering \includegraphics[width=\textwidth]{example-image-b} \subcaption{Example B}\label{fig:b} \end{minipage} \hfill\null \caption{Two figures with subcaption and minipage} \end{figure} \end{document}

答え1

前述のオンライン コンパイラは、非常に古い KOMA-Script バージョンを使用します。

ドキュメントクラス: scrartcl 2013/12/19 v3.12 KOMA-Script ドキュメントクラス (記事)

現在のバージョンは 3.22 で、バージョン 3.23 はまもなく CTAN で利用可能になります。星印の付いたバージョン\iheadなどはバージョン 3.14 で導入されています。

更新できない場合は、以下を使用します。

\usepackage[automark,markcase=upper,headsepline]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

完全な例:

\documentclass{scrartcl}
\usepackage[automark,headsepline,markcase=upper]{scrlayer-scrpage}
\clearpairofpagestyles
\ihead{\headmark}
\ofoot[\pagemark]{\pagemark}

\usepackage{blindtext}
\begin{document}
\thispagestyle{plain}
{\huge\KOMAScriptVersion\par}
\blinddocument
\end{document}

質問に記載されているオンライン コンパイラによる出力:

ここに画像の説明を入力してください

答え2

掲載されたコードは

! Paragraph ended before \@fileswith@ptions was complete.

hyperref オプションに空白行があるためです。

それを削除すると

\usepackage[
  pdftoolbar = false,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<<<<<<<<<<,
  pdfmenubar = false, 
  pdftitle   = mwe,
  pdfauthor  = {author},
  colorlinks,
  allcolors =  {blue},
  bookmarks         = true,
  bookmarksopen     = true, 
  bookmarksnumbered = true
]{hyperref}

するとエラーが出る

! Undefined control sequence.
<argument> \undefinedpagestyle 

l.48 \thispagestyle{leer}

定義されているページ スタイルのタイプミスなのか、そのページ スタイルの定義が欠落しているのかはわかりません。ただし、それを削除すると、次のようになります。

%\thispagestyle{leer}

すると、ドキュメントはエラーなしで実行されます。

関連情報