13

I am using the \documentclass{ctexart}, and this document class centers the section title by default. How could I left align the section title?

Werner
  • 603,163

3 Answers3

8

Here are two options:

  1. Add \raggedright to all \sections globally:

    \documentclass{ctexart}
    \usepackage{lipsum}
    \makeatletter
    \g@addto@macro{\CTEX@section@format}{\raggedright}
    \makeatother
    \begin{document}
    \section{A section}
    \lipsum
    \end{document}
    
  2. Use sectsty and 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:

enter image description here

One would have to follow a similar technique for other sectional units.

Mico
  • 506,678
Werner
  • 603,163
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}

enter image description here

egreg
  • 1,121,712
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