如何在文档右侧创建部分和章节?

如何在文档右侧创建部分和章节?

我在scrartcl课堂上用希伯来语(KOMA 脚本)写一篇文档,当我用英语写作时,各个部分和章节都在左侧:
在此处输入图片描述

我怎样才能将它移动到右边?(就像在scrbook- 那里很完美!)

梅威瑟:

    % Preview source code

    %% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
    %% Do not edit unless you really know what you are doing.
    \documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
    \usepackage{fontspec}
    \setlength{\parindent}{0bp}

    \makeatletter

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
    \pdfpageheight\paperheight
    \pdfpagewidth\paperwidth


    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
    \newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
    \newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
    \newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
    \AtBeginDocument{
    \renewcommand\footnoterule{%
      \kern -3pt
      \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth}
      \kern 2.6pt
    }}
    \renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
    \addtokomafont{disposition}{\rmfamily}

    \makeatother

    \usepackage{polyglossia}
    \setdefaultlanguage{hebrew}
    \setotherlanguage{english}
    \begin{document}
    \begin{english}[variant=american]%

    \part{abc}

    \section{abc \texthebrew{גדה}}
    \end{english}%

    \end{

document}

谢谢你!

答案1

在 scrbook 中也会发生同样的事情。您在 \section 周围放置了一个英语环境,这会根据此语言的需要将其移动到左侧。

  \begin{document}


    \part{abc}

    \section{abc \texthebrew{גדה}}
    %

    \end{document}

它按预期工作(我不得不改变字体):

在此处输入图片描述

答案2

KOMA-Script 的结果绝对正确且符合预期。我添加了一些注释来解释其工作原理:

% Most of the code has been produces using LyX 2.3.2-2 which produces
% very ugly code, that often is not recommended by the KOMA-Script author,
% typographers or LaTeX experts.
\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{fontspec}
\setlength{\parindent}{0bp}% Nonsense: see https://komascript.de/faq_parindent

\makeatletter% Not needed!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight % Nonsense: Does fail with LuaTeX!
\pdfpagewidth\paperwidth   % Nonsense: Does fail with LuaTeX!


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\AtBeginDocument{
\renewcommand\footnoterule{% Nonsense: Does break KOMA-Script!
  \kern -3pt
  \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth}
  \kern 2.6pt
}}
\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\addtokomafont{disposition}{\rmfamily}

\makeatother

\usepackage{polyglossia}% Polyglossia has known bugs!
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{english}[variant=american]% Here you switch to English, so not
                                 % longer RTL but LTR. Default for parts
                                 % and sections in LTR is \raggedright =
                                 % left aligned. But you can change is
                                 % using:
  \renewcommand*{\raggedpart}{\raggedleft}%
  \renewcommand*{\raggedsection}{\raggedleft}%
  \part{abc}

  \section{abc \texthebrew{גדה}}
\end{english}%

% Now, we are Hebrew again, so we are in RTL. Default for parts and
% sections is \raggedright that is right aligned in RTL:

\part{\textenglish{abc}}
\section{\textenglish{abc} גדה}

\end{document}

结果

如果用户或 LyX 生成奇怪的代码,这既不是 KOMA-Script 的错误,也不是 LaTeX 的错误。

顺便说一句:事实并非如此,scrbook标题的对齐方式不同:

% Most of the code has been produces using LyX 2.3.2-2 which produces
% very ugly code, that often is not recommended by the KOMA-Script author,
% typographers or LaTeX experts.
\documentclass[a4paper,english,hebrew,numbers=noenddot,oneside]{scrbook}
\usepackage{fontspec}
\setlength{\parindent}{0bp}% Nonsense: see https://komascript.de/faq_parindent

\makeatletter% Not needed!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight % Nonsense: Does fail with LuaTeX!
\pdfpagewidth\paperwidth   % Nonsense: Does fail with LuaTeX!


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Simple CLM}
\AtBeginDocument{
\renewcommand\footnoterule{% Nonsense: Does break KOMA-Script!
  \kern -3pt
  \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth}
  \kern 2.6pt
}}
\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\addtokomafont{disposition}{\rmfamily}

\makeatother

\usepackage{polyglossia}% Polyglossia has known bugs!
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{english}[variant=american]% Here you switch to English, so not
                                 % longer RTL but LTR. Default for chapters
                                 % and sections in LTR is \raggedright =
                                 % left aligned. But you can change is
                                 % using:
  \chapter{abc}

  \section{abc \texthebrew{גדה}}
\end{english}%

\end{document}

(这里我只把它改成scrartclscrbook并添加了选项oneside并把它改成\part\chapter。)

scrbook因此,无论使用还是都没有区别scrartcl

使用 Scrbook

相关内容