将页码设置为仅显示在右侧

将页码设置为仅显示在右侧

正如标题所示,如何设置页码仅显示在右侧?

因为我不知道哪个设置导致了这个问题,我必须在哪里查看设置了哪些选项?(我正在使用\frontmatter/\mainmatter命令,如果它们与此有关......)

\documentclassscr-book

这是我的主页:

\documentclass[11pt,a4paper,bibtotoc,idxtotoc,headsepline,footsepline,footexclude,BCOR12mm,DIV13]{scrbook} 

% include settings
\input{components/settings}

% include commands
\input{components/commands}


%\makeindex
    %% inter line spacing
%\linespread{1.0}

\makeglossary

\begin{document}

    \frontmatter

    \mainmatter

\end{document}

我的设置:

% Included by MAIN.TEX

\renewcommand{\sectfont}{\normalfont \bfseries}        % Schriftart der Kopfzeile

% manipulate footer
\usepackage{scrpage2}
\pagestyle{scrheadings}
\ifoot[\footertext]{\footertext} % \footertext set in INFO.TEX
%\setkomafont{pagehead}{\normalfont\rmfamily}
\setkomafont{pagenumber}{\normalfont\rmfamily}

%% allow sophisticated control structures
\usepackage{ifthen}

% use Palatino as default font
\usepackage{palatino}

% enable special PostScript fonts
\usepackage{pifont}

% make thumbnails
\usepackage{thumbpdf}

%to use the subfigures
%\usepackage{subfigure}


\usepackage{colortbl}


%% show program code\ldots
%\usepackage{verbatim}
%\usepackage{program}

\usepackage{multirow}

%% use colors
\usepackage{color}

%% make fancy math
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{textcomp}
\usepackage{yhmath} % f�r die adots 
%% mark text as preliminary
%\usepackage[draft,german,scrtime]{prelim2e}

%% create an index
\usepackage{makeidx}

% for the program environment
\usepackage{float}

%% load german babel package for german abstract
%\usepackage[german,american]{babel}
\usepackage[german,english]{babel}
\selectlanguage{english}

% use german characters as well
\usepackage[latin1]{inputenc}       % allow Latin1 characters

% use initals dropped caps - doesn't work with PDF
\usepackage{dropping}


\usepackage{styles/shortoverview}
\ifx\pdftexversion\undefined
 %% use PostScript graphics
 \usepackage[dvips]{graphicx}
 \DeclareGraphicsExtensions{.eps,.epsi}
 \graphicspath{{figures/}{figures/review}} 
 %% allow rotations
 \usepackage{rotating}

 \usepackage[hypertex,hyperindex=false,colorlinks=false]{hyperref}
\else %% reduce output size \pdfcompresslevel=9

 \usepackage[pdftex]{graphicx}
 \DeclareGraphicsExtensions{.jpg,.JPG,.png,.pdf,.eps}
 \graphicspath{{figures/}} 

 %% Load float package, for enabling floating extensions
 \usepackage{float}

 %% allow rotations
 \usepackage{rotating}
 %% use pdftex version of hyperref
 \usepackage[pdftex,colorlinks=true,linkcolor=red,citecolor=red,%
 anchorcolor=red,urlcolor=red,bookmarks=true,%
 bookmarksopen=true,bookmarksopenlevel=0,plainpages=false%
 bookmarksnumbered=true,hyperindex=false,pdfstartview=%
 ]{hyperref}
\fi

答案1

更新

在下面的评论中,OP提到该文件将是片面的。

如果文档是单面的,则应设置选项oneside或之一。然后您可以使用twoside=false

\documentclass[
  %11pt,a4paper,% default
  bibliography=totoc,index=totoc,% <- syntax updated
  headsepline,footsepline,
  footinclude=false,% <- syntax updated
  BCOR=12mm,DIV=13,% <- syntax updated
  oneside
  %twoside=false% <- added -> onesided document
]{scrbook}
\usepackage[german,main=english]{babel}% <- really german and not ngerman??
\addtokomafont{disposition}{\normalfont\bfseries}% <- changed to KOMA-Script syntax

\usepackage[automark
   %,plainfootsepline% <- if there should be a footsepline on plain pages too
]{scrlayer-scrpage}% <- successor of deprecated scrpage2; sets page style scrheadings automatically
\clearpairofpagestyles
\ohead{\headmark}
\ifoot*{\footertext}
\ofoot*{\pagemark}
\setkomafont{pagenumber}{\normalfont\rmfamily}

\newcommand*\footertext{Dummy text in the footer}% <- \footertext must be defined 

\usepackage{blindtext}% only for dummy text in this example
\begin{document}
\frontmatter
\tableofcontents
\chapter{Chapter in Frontmatter}
\Blindtext
\mainmatter
\blinddocument
\end{document}

结果:

在此处输入图片描述

或者使用过时的软件包scrpage2不建议):

\documentclass[
  %11pt,a4paper,% default
  bibliography=totoc,index=totoc,% <- syntax updated
  headsepline,footsepline,
  footinclude=false,% <- syntax updated
  BCOR=12mm,DIV=13,% <- syntax updated
  oneside
  %twoside=false% <- added -> onesided document
]{scrbook}
\usepackage[german,main=english]{babel}% <- really german and not ngerman??
\addtokomafont{disposition}{\normalfont\bfseries}% <- changed to KOMA-Script syntax


\usepackage
  %[plainfootsepline]% <- if there should be a footsepline on plain pages too
{scrpage2}% <- outdated!!
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead{\headmark}
\ifoot[\footertext]{\footertext}
\ofoot[\pagemark]{\pagemark}
\setkomafont{pagenumber}{\normalfont\rmfamily}

\newcommand*\footertext{Dummy text in the footer}% <- \footertext must be defined 

\usepackage{blindtext}% only for dummy text in this example
\begin{document}
\frontmatter
\tableofcontents
\chapter{Chapter in Frontmatter}
\Blindtext
\mainmatter
\blinddocument
\end{document}

原始答案

您的代码确实过时了。例如,KOMA-Script 选项多年来一直使用键值语法。该软件包scrpage2自 2014 年以来也已弃用。它的后继者是scrlayer-scrpage

您的意思是,页码应该只出现在右/奇数页的右侧吗?那么您可以使用

\documentclass[
  %11pt,a4paper,% default
  bibliography=totoc,index=totoc,% <- syntax updated
  headsepline,footsepline,
  footinclude=false,% <- syntax updated
  BCOR=12mm,DIV=13% <- syntax updated
]{scrbook}
\usepackage[german,main=english]{babel}% <- really german and not ngerman??
\addtokomafont{disposition}{\normalfont\bfseries}% <- changed to KOMA-Script syntax

\usepackage[automark
  %,plainfootsepline <- if there should be a footsepline on plain pages too
]{scrlayer-scrpage}% <- successor of deprecated scrpage2; sets page style scrheadings automatically
\clearpairofpagestyles
\ohead{\headmark}
\ifoot*{\footertext}
\rofoot*{\pagemark}% <- r=right, o=odd
\setkomafont{pagenumber}{\normalfont\rmfamily}

\newcommand*\footertext{Dummy text in the footer}% <- \footertext must be defined 

\usepackage{blindtext}% only for dummy text in this example
\begin{document}
\frontmatter
\tableofcontents
\chapter{Chapter in Frontmatter}
\Blindtext
\mainmatter
\blinddocument
\end{document}

结果:

页码仅显示在奇数页的右侧

但如果页码也应该位于偶数页的右侧,则\footertext必须在偶数页和奇数页上都保留。因此,您可以使用

\lofoot*{\footertext}
\lefoot*{\footertext}
\rofoot*{\pagemark}
\refoot*{\pagemark}

但请注意结果

奇数页和偶数页的右侧均有页码

对于双面文件来说,这是不寻常的。

相关内容