
Eu tenho o seguinte documento de látex compilado em org-mode
.
% Created 2020-03-29 Sun 00:33
% Intended LaTeX compiler: xelatex
\documentclass[12pt,a4paper]{article}
\usepackage{xeCJK}
%\usepackage[heading]{CJK}
\usepackage{zhnumber} % package for Chinese formatting of date time (use /zhtoday)
%\usepackage[yyyymmdd]{datetime} % set date time to numeric
\usepackage{titlesec}
\usepackage{titling}
\usepackage{fontspec} % packages for title and section-heading font setting.
\usepackage{newunicodechar}
% Set Header and Numbering Depth
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
% Set Font.
\setCJKmainfont{MingLiU}
\setCJKsansfont{Kaiti TC} % Set Chinese font. NOTE: Remember to append CJK before of the font class. CJK HAS to be there for the font to show.
\setCJKmonofont{PingFang TC}
% Use Chinese numberals for section numbering
\renewcommand\thesection{\zhnum[style=Traditional]{section}}
\renewcommand\thesubsection{\zhnum{subsection}}
\renewcommand\thesubsubsection{\zhnum{subsubsection}}
% \renewcommand\thesection{\zhnum{section}}
% \renewcommand\thesubsection{\Alph{subsection}}
% \renewcommand\thesubsubsection{\arabic{subsubsection}}
\renewcommand*\theparagraph{\arabic{paragraph}}
\renewcommand*\thesubparagraph{\arabic{subparagraph}}
% Set formats for each heading level. 'sffamily' will point to the sans-serif font. In this case, 「楷體」.
\titleformat*{\section}{\Large\bfseries\sffamily\filcenter} % center heading
\titleformat*{\subsection}{\fontsize{18}{20}\bfseries\sffamily}
\titleformat*{\subsubsection}{\fontsize{16}{18}\bfseries\sffamily}
% The `titlesec` package is used over here to make use of `\paragraph` and `\subparagraph` as headings. Up to five levels of headings can be implemented this way.
\titleformat{name=\paragraph}[display]
{\fontsize{14}{16}\bfseries\sffamily}{}{1em}{}
% New line after heading. (`\paragraph` and `\subparagraph` would not automatically generate a new line after the heading text. )
\titlespacing*{\paragraph}{\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\titleformat{name=\paragraph,numberless}[display]
{\fontsize{14}{16}\bfseries\sffamily}{\theparagraph}{1em}{}
% New line after heading. (`\paragraph` and `\subparagraph` would not automatically generate a new line after the heading text. )
\titlespacing*{\paragraph}{\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\titleformat{name=\subparagraph}[display]
{\fontsize{12}{14}\bfseries\sffamily}{\thesubparagraph}{1em}{}
\titlespacing*{\subparagraph}{\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\titleformat{name=\subparagraph,numberless}[display]
{\fontsize{12}{14}\bfseries\sffamily}{}{1em}{}
\titlespacing*{\subparagraph}{\parindent}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
% Set title font.
\renewcommand{\maketitlehooka}{\sffamily}
% Tweak default settings.
\renewcommand{\baselinestretch}{1.2} % Set line width.
\renewcommand{\contentsname}{目次} % Translate content page title to Chinese. (Could possibly be done automatically with '\usepackage[heading]{CJK}'. TODO experiment. )
% [FIXME] ox-latex 的設計不良導致 hypersetup 必須在這裡插入
\usepackage{hyperref}
\hypersetup{
colorlinks=true, %把紅框框移掉改用字體顏色不同來顯示連結
linkcolor=[rgb]{0,0.37,0.53},
citecolor=[rgb]{0,0.47,0.68},
filecolor=[rgb]{0,0.37,0.53},
urlcolor=[rgb]{0,0.37,0.53},
pagebackref=true,
linktoc=all,}
\usepackage{hyperref}
\usepackage[utf8x]{inputenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\author{Test}
\date{\today}
\title{}
\begin{document}
\tableofcontents \clearpage
\section{Section}
\label{sec:org9101c0e}
some text
\subsection{Subsection}
\label{sec:org8fa5441}
some text
\subsubsection{Subsubsection}
\label{sec:orgba871aa}
some text
\paragraph{Paragraph}
\label{sec:orgeb7d238}
some text
\subparagraph{Subparagraph}
\label{sec:org7791480}
some text
\section{Section}
\label{sec:org27630bd}
some text
\subsection{Subsection}
\label{sec:orgabf9df6}
some text
\subsubsection{Subsubsection}
\label{sec:org648c2c5}
some text
\paragraph{Paragraph}
\label{sec:org1ee8ae9}
some text
\subparagraph{Subparagraph}
\label{sec:org1056bb1}
some text
\end{document}
Eu gostaria \paragraph
de \subparagraph
não ser numerado, mas ainda aparecer no TOC.
Eu também gostaria, se possível, de usar estilos de numeração diferentes para cada (sub)título numerado.
Especificamente, gostaria de usar \\zhnum[style=Traditional,Financial]{section}
títulos \section
de nível;
壹、heading
貳、heading
參、heading
\\zhnum{subsection}
para \subsection
títulos;
一、heading
二、heading
三、heading
E \\zhnum{subsubsection}
entre parênteses para \subsubsection
títulos;
(一)heading
(二)heading
(三)heading
Gostaria que o resultado fosse algo assim:
Como isso pode ser feito com o código?
Dados de origem:
#+OPTIONS: H:5 num:t
* Section
some text
** Subsection
some text
*** Subsubsection
some text
**** Paragraph
some text
***** Subparagraph
some text
* Section
some text
** Subsection
some text
*** Subsubsection
some text
**** Paragraph
some text
***** Subparagraph
some text
Responder1
O principal problema parece ser que \zhnum
junto com [style={Traditional,Financial}]
(observe as chaves ao redor do argumento, aliás) não funciona muito bem junto com o índice, exibindo 零 (zero) para cada seção. Para mim, isso parece um bug no zhnumber
pacote; como uma solução rápida, uso um contador personalizado para a seção que é aumentada em \thesection
.
Também alterei algumas outras partes do seu código para corresponder às suas ideias, mas você provavelmente terá que ajustar um pouco o espaçamento relacionado (por exemplo, eu não sabia sobre o espaçamento para \paragraph
e \subparagraph
). Tentei modificar o mínimo de lugares possível.
Removi todos os seus comentários, e cada comentário que você encontra no código a seguir é uma alteração que apliquei:
\documentclass[12pt,a4paper]{article}
\usepackage{xeCJK}
\usepackage{zhnumber}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{fontspec}
\usepackage{newunicodechar}
\usepackage{tocloft} % adding the tocloft package for toc customization
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{5}
% note: I'm using different fonts only because I don't have yours
\setCJKmainfont{Noto Serif CJK TC}
\setCJKsansfont{Noto Sans CJK TC}
\setCJKmonofont{Noto Mono CJK TC}
% in your example the titles in the toc are all sans serif, so I'll just add that here
% feel free to leave that out in your original document,
% it's just for visual comparability
\renewcommand{\cftsecfont}{\bfseries\sffamily}
\renewcommand{\cftsubsecfont}{\sffamily}
\renewcommand{\cftsubsubsecfont}{\sffamily}
\renewcommand{\cftparafont}{\sffamily}
\renewcommand{\cftsubparafont}{\sffamily}
% zhnum[style={Traditional,Financial}] doesn't work with the section counter,
% so we define our own counter and increase it every time in \thesection
\newcounter{mysec}[section]
\renewcommand\thesection{%
\addtocounter{mysec}{1}%
\zhnum[style={Traditional,Financial}]{mysec}、}
\renewcommand\thesubsection{\zhnum{subsection}、} % added a 、
\renewcommand\thesubsubsection{(\zhnum{subsubsection})} % added parentheses
% (full-width, don't know if that's what you want)
\renewcommand\theparagraph{} % you don't want paragraph numbers
\renewcommand\thesubparagraph{} % nor subparagraph numbers
% we have to adjust the spacing in the toc because the section label is longer than usual
\addtolength\cftsecnumwidth{1em}
\addtolength\cftsubsecindent{1em}
\addtolength\cftsubsubsecindent{1em}
% here we need to make sure the normal section counter is accessed
\titleformat{\section}{\Large\bfseries\sffamily\filcenter}
{\zhnum[style={Traditional,Financial}]{section}、}{.5em}{}
% not really sure what you intend to achieve with \fontsize but I'll leave it here
\titleformat*{\subsection}{\fontsize{18}{20}\bfseries\sffamily}
\titleformat*{\subsubsection}{\fontsize{16}{18}\bfseries\sffamily}
% no extra version for numberless is necessary since no numbers are used anyways
% also you get newlines from omitting the [display] in \titleformat already
\titleformat{\paragraph}
{\fontsize{14}{16}\bfseries\sffamily}{}{0em}{}
\titleformat{\subparagraph}
{\fontsize{12}{14}\bfseries\sffamily}{}{0em}{}
% we need the following so that they don't indent (second argument, 0em);
% you'll have to adjust the spacing though since this is not display style anymore:
\titlespacing*{\paragraph}{0em}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\titlespacing*{\subparagraph}{0em}{3.25ex plus 1ex minus .2ex}{.75ex plus .1ex}
\renewcommand{\maketitlehooka}{\sffamily}
\renewcommand{\baselinestretch}{1.2}
\renewcommand{\contentsname}{目次}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=[rgb]{0,0.37,0.53},
citecolor=[rgb]{0,0.47,0.68},
filecolor=[rgb]{0,0.37,0.53},
urlcolor=[rgb]{0,0.37,0.53},
% pagebackref=true, % this is ignored
linktoc=all}
\usepackage{hyperref}
% \usepackage[utf8x]{inputenc} do not use inputenc with XeTeX
% \usepackage{fixltx2e} not required any more
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\author{Test}
\date{\today}
\title{}
\begin{document}
% your document appears to be completely sans serif so I just set it here
\sffamily
%% from here on I haven't changed anything
\tableofcontents \clearpage
\section{Section}
\label{sec:org9101c0e}
some text
\subsection{Subsection}
\label{sec:org8fa5441}
some text
\subsubsection{Subsubsection}
\label{sec:orgba871aa}
some text
\paragraph{Paragraph}
\label{sec:orgeb7d238}
some text
\subparagraph{Subparagraph}
\label{sec:org7791480}
some text
\section{Section}
\label{sec:org27630bd}
some text
\subsection{Subsection}
\label{sec:orgabf9df6}
some text
\subsubsection{Subsubsection}
\label{sec:org648c2c5}
some text
\paragraph{Paragraph}
\label{sec:org1ee8ae9}
some text
\subparagraph{Subparagraph}
\label{sec:org1056bb1}
some text
\end{document}
Resultado: