I am using a style guide that works perfectly fine. It prints the section/subsection names in italics but it prints the numbering corresponding to it in normal font. I want to modify the style file so that the Section numbering also appears in italics.
Current: 1.1 Trees
Required: 1.1 Trees
I have spent a lot of hours figuring out how to do it but unable to find any solution to it. I will really appreciate if anyone can tell me how to do it. The style file i am using is as follows (only attaching the relevant portions):
\let\@xp=\expandafter
\let\@nx=\noexpand
\newdimen\normalparindent
\normalparindent=\parindent
\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi}
\let\indentlabel\@empty
\def\@tochangmeasure#1{\sbox\z@{#1}%
\ifdim\wd\z@>\csname r@tocindent\@toclevel\endcsname\relax
\expandafter\xdef\csname r@tocindent\@toclevel\endcsname{\the\wd\z@}%
\fi
}
\long\def\@ifempty#1{\@xifempty#1@@..\@nil}
\long\def\@xifempty#1#2@#3#4#5\@nil{%
\ifx#3#4\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
\long\def\@ifnotempty#1{\@ifempty{#1}{}}
\AtBeginDocument{%
\@for\@tempa:=-1,0,1,2,3\do{%
\@ifundefined{r@tocindent\@tempa}{%
\expandafter\gdef\csname r@tocindent\@tempa\endcsname{0pt}}{}%
}%
}
\let\sectionname\@empty
\let\subsectionname\@empty
\let\subsubsectionname\@empty
\def\thesection{\arabic{section}}
\newcommand{\logicalnumbering}{\gdef\thesection{\thechapter.\arabic{section}}}
\setcounter{secnumdepth}{3}
%=============================================================================
\def\section{\@startsection{section}{1}%
\z@{%.7\baselineskip\@plus
.01\baselineskip}{.01\baselineskip}%
{\normalfont\itshape%\bfseries\centering
}}
\def\subsection{\@startsection{subsection}{2}%
%\normalparindent
\z@{%.5\baselineskip\@plus.7
.01\baselineskip}{.01\baselineskip}%
{\normalfont\itshape}}
\def\subsubsection{\@startsection{subsubsection}{3}%
%\normalparindent
\z@{.01\baselineskip}
{.01\baselineskip}%
{\normalfont\itshape}}
\def\paragraph{\@startsection{paragraph}{4}%
\normalparindent\z@{-\fontdimen2\font}%
\normalfont}
\def\subparagraph{\@startsection{subparagraph}{5}%
\z@\z@{-\fontdimen2\font}%
\normalfont}
%===============================================================================
\def\@startsection#1#2#3#4#5#6{%
\if@noskipsec \leavevmode \fi
\par \@tempskipa #4\relax
\@afterindenttrue
\ifdim \@tempskipa <\z@ \@tempskipa -\@tempskipa \@afterindentfalse\fi
\if@nobreak \everypar{}\else
\addpenalty\@secpenalty\addvspace\@tempskipa\fi
\@ifstar{\@dblarg{\@sect{#1}{\@m}{#3}{#4}{#5}{#6}}}%
{\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}%
}
\def\@sect#1#2#3#4#5#6[#7]#8{%
\edef\@toclevel{\ifnum#2=\@m 0\else\number#2\fi}%
\ifnum #2>\c@secnumdepth \let\@secnumber\@empty
\else \@xp\let\@xp\@secnumber\csname the#1\endcsname\fi
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\edef\@svsec{\ifnum#2<\@m
\@ifundefined{#1name}{}{%
\ignorespaces\csname #1name\endcsname\space}\fi
\@nx\textup{%
\csname the#1\endcsname.}\enspace %This is where it prints the section numbers
}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@ % then this is not a run-in section heading
\begingroup #6\relax
\@hangfrom{\hskip #3\relax\@svsec}{\interlinepenalty\@M #8\par}%
\endgroup
\csname #1mark\endcsname{#7}%
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
\else
\def\@svsechd{#6\hskip #3\@svsec
\@ifnotempty{#8}{\ignorespaces#8\unskip
\@addpunct.}%
\ifnum#2>\@m \else \@tocwrite{#1}{#8}\fi
}%
\fi
\global\@nobreaktrue
\@xsect{#5}}
\let\@ssect\relax
\def\@tocpagenum#1{\hss{\mdseries #1}}
\def\@tocwrite#1{\expandafter\@tocwriteb\csname toc#1\endcsname{#1}}
\def\@tocwriteb#1#2#3{%
\addcontentsline{toc}{#2}{\protect\numberline{\@secnumber.}{#3}}}
\def\bysame{\leavevmode\hbox to3em{\hrulefill}\thinspace}
Document Classes ⇒ Section Numbering in italics
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Stefan Kottwitz
- Site Admin
- Posts: 10345
- Joined: Mon Mar 10, 2008 9:44 pm
Re: Section Numbering in italics
Hi Gaurkuma,
because you've posted this question two times with the same text I've deleted one copy.
If you want to modify the style file you just need to change \textup into \textit in the line before the one you marked red.
Stefan
because you've posted this question two times with the same text I've deleted one copy.
If you want to modify the style file you just need to change \textup into \textit in the line before the one you marked red.
Stefan
LaTeX.org admin
Re: Section Numbering in italics
It Works! Thanks so much.....I spent hours figuring out the change...thanks once again for your prompt reply...it was really helpful...