KOMA-Script에서 섹션 제목의 공백을 제거하는 방법

KOMA-Script에서 섹션 제목의 공백을 제거하는 방법

MWE는 다음과 같습니다.

\documentclass{scrartcl}
\usepackage{adforn}


\renewcommand{\sectionlinesformat}[4]{%
        \ifstr{#1}{section}{%
               {\adforn{30} {#3}. {#4} \adforn{58}}
        }
    {{\hskip#2#3}{#4}}%
}\makeatother

\begin{document}

\section{ABC}

\end{document} 

출력은 다음과 같습니다.
여기에 이미지 설명을 입력하세요

나는 그것이 다음과 같기를 바란다:1. ABC그리고는 아니다1 . 알파벳 ("1"과 "." 사이에 공백이 없습니다).
것이 가능하다? 가능하다면 어떻게 할 수 있습니까?

감사합니다!

답변1

매크로 끝에 가 \sectionformat포함되어 있습니다 . \enskip그것 없이도 재정의할 수 있습니다:

\documentclass{scrartcl}
\usepackage{adforn}

\def\sectionformat{\thesection\autodot}% \enskip
\renewcommand{\sectionlinesformat}[4]{%
        \ifstr{#1}{section}{%
               {\adforn{30} {#3}. {#4} \adforn{58}}
        }
    {{\hskip#2#3}{#4}}%
}\makeatother

\begin{document}

\section{ABC}

\end{document}

여기에 이미지 설명을 입력하세요

답변2

그룹 중괄호를 최소한으로 줄이고 .다음 중 하나를 추가해야 합니다 \sectionformat.

\documentclass{scrartcl}
\usepackage{adforn}

\renewcommand*{\sectionformat}{\thesection.\enskip}% replaced \autodot by .
\renewcommand{\sectionlinesformat}[4]{%
  \ifstr{#1}{section}%
    {\adforn{30} #3#4 \adforn{58}}%
    {\hskip#2#3#4}%
}\makeatother

\begin{document}

\section{ABC}

\end{document} 

또는 numbers=withdot모든 섹션 수준에 점을 추가하도록 선택합니다.

\documentclass[numbers=enddot]{scrartcl}
\usepackage{adforn}

\renewcommand{\sectionlinesformat}[4]{%
  \ifstr{#1}{section}%
    {\adforn{30} #3#4 \adforn{58}}%
    {\hskip#2#3#4}%
}

\begin{document}

\section{ABC}

\end{document} 

두 예제 모두 다음과 같은 결과를 가져옵니다.

1. ABC 오

\autodot참고: in 을 \sectionformat하드 코딩된 것과 결합하면 안 됩니다 .( 사양에 따라 위치가 잘못된 in \autodot또는 on도 아님). 이렇게 하면 두 개의 점이 생길 수 있습니다.\sectionlinesformat

다음을 살펴보시기 바랍니다.KOMA-스크립트 매뉴얼의 기본값 과 , 및 \sectionformat의 의미에 대해 설명합니다 .numbers=withdot\sectionformat\autodot

참고: \makeatother귀하의 예에 있는 는 필요하지 않으며 제거해야 합니다(그래서 그렇게 했습니다).

주제에서 벗어남: 또한 코드 중간에 있는 실제 공백 }이나 뒤의 개행 문자로 인한 허위 공백을 피해야 합니다 .{


의견에 따르면 이것이 작동하지 않는다고 주장합니다 hebrew.

\documentclass[numbers=enddot]{scrartcl}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\usepackage{adforn}

\renewcommand{\sectionlinesformat}[4]{%
  \ifstr{#1}{section}%
    {\adforn{30} #3#4 \adforn{58}}%
    {\hskip#2#3#4}%
}

\begin{document}

\section{גדה}

\end{document} 

그리고

\documentclass{scrartcl}
\usepackage{polyglossia}
\setmainlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\usepackage{adforn}

\renewcommand*{\sectionformat}{\thesection.\enskip}% replaced \autodot by .
\renewcommand{\sectionlinesformat}[4]{%
  \ifstr{#1}{section}%
    {\adforn{30} #3#4 \adforn{58}}%
    {\hskip#2#3#4}%
}

\begin{document}

\section{גדה}

\end{document} 

둘 다 결과는 다음과 같습니다.

o דג .1 O

RL을 사용하는 것이 올바른 것 같습니다.

관련 정보