Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my thesis and using \documentclass{thesis.tex}, how do I left align only my sections and subsections without it affecting the chapter which is centered

share|improve this question
    
You mean the section and subsection headings? –  Count Zero Jul 16 '12 at 11:05
1  
There are scores of thesis.cls around. Can you point to a net address for the one you're using? –  egreg Jul 16 '12 at 11:48
    
yes i mean sections and subsections aligning to the left. Not familiar with other scores of thesis.cls. just using \documentclass{thesis}. –  chris Jul 16 '12 at 13:09
1  
@chris I understand what you're doing. But it's clearly a local class file and without seeing what it does it's impossible to help. If it's an official class of your university, you shouldn't be modifying its style. –  egreg Jul 16 '12 at 14:48
add comment

1 Answer

I assume you are using the thesis.cls in the contrib/thesis directory of CTAN, which indeed does produce centered headings. (This is the only file of that name on CTAN and seems to be included in the MikTex distribution, but not TeXLive.)

There is a nocenter package option that affects headings at all levels. But to adjust just sections and subsections, it appears that you need to cut and paste code from the class file (the full path to which is give in the log file). Specifically you need to redefine \section and \subsection. As these commands use code containing the @ character you will need to include this in between \makeatletter and \makeatother.

A minimal example showing this is:

\documentclass{thesis}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                               {-3.5ex \@plus -1ex \@minus -.2ex}%
                               {2.3ex \@plus.2ex}%
                               {\raggedright
                               \reset@font\s@font}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                 {-3.25ex\@plus -1ex \@minus -.2ex}%
                                 {1.5ex \@plus .2ex}%
                                 {\raggedright
                                  \reset@font\ss@font}}
\makeatother

\begin{document}
A full line of text to pad out the example and show the spacing is as
requested in the posted question.
\section{Middle}
A full line of text to pad out the example and show the spacing is as
requested in the posted question.
\subsection{Last}
A full line of text to pad out the example and show the spacing is as
requested in the posted question.

\end{document}

Sample output

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.