I am using the \documentclass{ctexart}, and this document class centers the section title by default. How could I left align the section title?
Asked
Active
Viewed 5.0k times
13
Werner
- 603,163
Zongyi Zhao
- 185
3 Answers
8
Here are two options:
Add
\raggedrightto all\sections globally:\documentclass{ctexart} \usepackage{lipsum} \makeatletter \g@addto@macro{\CTEX@section@format}{\raggedright} \makeatother \begin{document} \section{A section} \lipsum \end{document}Use
sectstyand modify\sectionfont:\documentclass{ctexart} \usepackage{lipsum} \usepackage{sectsty} \sectionfont{\bfseries\Large\raggedright} \begin{document} \section{A section} \lipsum \end{document}
Both instances above yield as output:

One would have to follow a similar technique for other sectional units.
-
1We need not hack into the package. Sorry for the Chinese document only. – Leo Liu May 29 '15 at 06:47
6
One would think that the definition
\def\CTEX@section@format{\Large\bfseries}
found on line 20 of ctex-article.def would the one valid for articles. For mysterious reasons, in the ctexcap.cfg file one finds
\def\CTEX@section@format{\Large\bfseries\centering}
The file states
% ctexcap.cfg: default Chinese caption settings
I find it confusing, but that's the situation. You can fix it by just restoring the first definition:
\documentclass{ctexart}
\usepackage{lipsum}
\makeatletter
\def\CTEX@section@format{\Large\bfseries}
\makeatother
\begin{document}
\section{A section}
\lipsum[2]
\end{document}

egreg
- 1,121,712
-
We need not hack into the package. Sorry for the Chinese document only. – Leo Liu May 29 '15 at 06:48
2
You should read the document first.
For ctex v1.02d and older version:
\CTEXsetup[format=\Large\bfseries]{section}
For ctex v2.0 and later:
\ctexset{section/format=\Large\bfseries}
Leo Liu
- 77,365