
.NET으로 컴파일된 다음 라텍스 문서가 있습니다 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}
번호가 지정되지 않았으면 좋겠지 \paragraph
만 \subparagraph
여전히 TOC에 표시됩니다.
또한 가능하다면 각 번호가 매겨진 (하위)제목에 대해 서로 다른 번호 매기기 스타일을 사용하고 싶습니다.
특히 레벨 제목 \\zhnum[style=Traditional,Financial]{section}
에 사용하고 싶습니다 .\section
壹、heading
貳、heading
參、heading
\\zhnum{subsection}
제목을 위해 \subsection
;
一、heading
二、heading
三、heading
그리고 제목 \\zhnum{subsubsection}
에 대해서는 괄호 안에 ;\subsubsection
(一)heading
(二)heading
(三)heading
결과가 다음과 같기를 바랍니다.
코드를 사용하여 이를 어떻게 수행할 수 있습니까?
소스 데이터:
#+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
답변1
주요 문제는 \zhnum
with [style={Traditional,Financial}]
(인수 주변의 중괄호 참고, btw)가 목차와 함께 잘 작동하지 않아 각 섹션에 零(0)이 표시된다는 것입니다. 나에게 이것은 패키지의 버그처럼 보입니다 zhnumber
. 빠른 해결 방법으로 \thesection
.
\paragraph
또한 귀하의 아이디어에 맞게 코드의 다른 부분도 변경했지만 아마도 간격 관련 내용을 약간 조정해야 할 것입니다(예를 들어 및 의 간격에 대해 몰랐습니다 \subparagraph
). 그래도 최대한 적은 곳을 수정하려고 노력했습니다.
귀하의 의견을 모두 제거했으며 다음 코드에서 찾은 모든 의견은 제가 적용한 변경 사항입니다.
\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}
결과: