Koma 字体:段落使用章节和节的字体样式

Koma 字体:段落使用章节和节的字体样式

在 koma 脚本中,有没有办法使用章节、节、小节等的字体样式来排版文本中的段落?谢谢,Harald

\documentclass[
    10pt,
    twoside,
    toc=listofnumbered,
    listof=flat,
    headinclude,
    footinclude,
    index=numbered
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\setparsizes{5.5mm}{5pt}{0pt plus 1fil}

\RedeclareSectionCommand[ 
  beforeskip=1pt, 
  afterskip=10mm,
  afterindent=false
]{chapter}

\RedeclareSectionCommand[ 
  beforeskip=5mm, 
  afterskip=5mm,
  afterindent=false
]{section}

\begin{document}
\chapter{MyChapter}
\blindtext[1]

\noindent Should look like MyChapter.
\section{MySection}
\blindtext[1]

\noindent Should look like MySection.
\end{document}

重复使用章节的字体样式

答案1

章节标题的字体设置存储在字体元素dispostionchaptersection)中。可以使用以下方法启用它们:

\usekomafont{disposition}\usekomafont{chapter}

或者

\usekomafont{disposition}\usekomafont{section}

例子:

\documentclass[
    10pt,
    twoside,
    toc=listofnumbered,
    listof=flat,
    headinclude,
    footinclude,
    index=numbered
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\setparsizes{5.5mm}{5pt}{0pt plus 1fil}

\RedeclareSectionCommand[ 
  beforeskip=1pt, 
  afterskip=10mm,
  afterindent=false
]{chapter}

\RedeclareSectionCommand[ 
  beforeskip=5mm, 
  afterskip=5mm,
  afterindent=false
]{section}

\begin{document}
\chapter{MyChapter}
\blindtext[1]

\noindent {\usekomafont{disposition}\usekomafont{chapter}Should look like MyChapter.\par}
\section{MySection}
\blindtext[1]

\noindent {\usekomafont{disposition}\usekomafont{section}Should look like MySection.\par}
\end{document}

您还可以使用 定义自己的字体元素\newkomafont

例子:

\documentclass[
    10pt,
    twoside,
    toc=listofnumbered,
    listof=flat,
    headinclude,
    footinclude,
    index=numbered
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\setparsizes{5.5mm}{5pt}{0pt plus 1fil}

\RedeclareSectionCommand[ 
  beforeskip=1pt, 
  afterskip=10mm,
  afterindent=false
]{chapter}

\RedeclareSectionCommand[ 
  beforeskip=5mm, 
  afterskip=5mm,
  afterindent=false
]{section}

\newkomafont{parchapter}{\usekomafont{disposition}\usekomafont{chapter}}
\newkomafont{parsection}{\usekomafont{disposition}\usekomafont{section}}

\begin{document}
\chapter{MyChapter}
\blindtext[1]

\noindent {\usekomafont{parchapter}Should look like MyChapter.\par}
\section{MySection}
\blindtext[1]

\noindent {\usekomafont{parsection}Should look like MySection.\par}
\end{document}

答案2

请尝试此代码。

\RequirePackage{fix-cm}%  needed when using Computer Modern typefaces
\documentclass[
fontsize = 10pt,
twoside,
toc=listofnumbered,
listof=flat,
headinclude,
footinclude,
index=numbered
]{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\setparsizes{5.5mm}{5pt}{0pt plus 1fil}

\RedeclareSectionCommand[ 
beforeskip=1pt, 
afterskip=10mm,
afterindent=false
]{chapter}

\RedeclareSectionCommand[ 
beforeskip=5mm, 
afterskip=5mm,
afterindent=false
]{section}

\renewcommand*{\familydefault}{\sfdefault} %

\begin{document}
    \chapter{MyChapter}

    \blindtext[1]
        
    \noindent Should look like \textbf{\huge MyChapter}.
    
    \section{MySection} 
        
    \blindtext[1]
        
    \noindent Should look like \textbf{\Large MySection}.
\end{document}

章节和节标题使用无衬线字体。

\renewcommand*{\familydefault}{\sfdefault}在序言中将全局设置这个字体系列。

韓國

相关内容