回忆录:将段落标题从“10. 练习”更改为“练习 10”

回忆录:将段落标题从“10. 练习”更改为“练习 10”

我用

\setparaheadstyle{\normalsize\itshape}
\setafterparaskip{1ex}

我想将数字向右移动并省略句号。我还想将整个标题向右对齐(使其向右对齐?)。有办法吗?

根据要求,MWE:

\documentclass[11pt,a4paper,oneside]{memoir}

\pagestyle{plain}

\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}

\setmainfont[Mapping=tex-text]{Liberation Serif}
\setsansfont[Mapping=tex-text]{Liberation Sans}
\setmonofont[Mapping=tex-text]{Liberation Mono}


%% Ensure sequential numbering of subsubsections.
\setsecnumdepth{paragraph}
\counterwithout{paragraph}{subsubsection}
\counterwithout{subsubsection}{subsection}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\Roman{subsection}}
\renewcommand{\thesubsubsection}{\S\arabic{subsubsection}}

\setparaheadstyle{\normalsize\itshape}
\setafterparaskip{1ex}

\setcounter{tocdepth}{3} % Must not precede the above

\begin{document}

    \chapter{Alfa}
        \section{Bravo}
            \subsection{Charlie}
                \paragraph{Exercise}
                \paragraph{Exercise}

\end{document}

答案1

致@Alexey Orlov 和未来的读者,我提出的解决方案仅基于回忆录。这是一个最小的工作示例,可以完成您想要的操作:

\documentclass{memoir}
\setsecnumdepth{paragraph}
\renewcommand{\theparagraph}{Question \arabic{paragraph}}% This does the trick
\setparaheadstyle{\normalsize\itshape}
\setafterparaskip{1ex}
\pagestyle{plain}
%\headstyles{default}% This is the modified style.
\begin{document}
\paragraph{} Text for the first exercise.% Observe '{}'
\end{document}

答案2

这是我的 MWE,经过改进,更新了。基于 titlesec 的解决方案非常令人满意。

\documentclass[11pt,a4paper,oneside]{memoir}

\pagestyle{plain}

\usepackage[explicit]{titlesec}

\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage{polyglossia}

\setmainfont[Mapping=tex-text]{Liberation Serif}
\setsansfont[Mapping=tex-text]{Liberation Sans}
\setmonofont[Mapping=tex-text]{Liberation Mono}


%% Ensure sequential numbering of subsubsections and paragraphs.
\setsecnumdepth{paragraph}
\counterwithout{paragraph}{subsubsection}
\counterwithout{subsubsection}{subsection}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\Roman{subsection}}
\renewcommand{\thesubsubsection}{\S\arabic{subsubsection}}
\setcounter{tocdepth}{3} % Must not precede the above

\titleformat{\paragraph}[hang]
{\raggedleft\normalfont\small\itshape\bfseries}{}{0pt}{#1 \arabic{paragraph}}


\begin{document}

    \chapter{Alfa}
        \section{Bravo}
            \subsection{Charlie}
                \paragraph{Exercise}
                \paragraph{Exercise}

\end{document}

相关内容