Text Formattingformatting subsection

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dmuthu_cse
Posts: 97
Joined: Fri Sep 04, 2009 4:56 pm

formatting subsection

Post by dmuthu_cse »

Hello friends,

I have small problem with my subsection.. Yeah it is fine, when i have small title as subsection, but when a longer title comes(i.e. when the title exceeds one line, then a line space is created between two titles). i think that is because of my definition of subsection.

Actually i want line space after every subsection title, but not in the case, if a title is about 2 lines.

If the title is 2 lines, then it should run countinously in the next line.

EX:
It should be,

2.1.1 ADVANTAGES OF INSTRUMENT TRANSFORMERS AS COMPARED WITH SHUNTS RESISTANCE AND MULTIPLIERS

This the relevant text........................

And not,

2.1.1 ADVANTAGES OF INSTRUMENT TRANSFORMERS AS COMPARED WITH SHUNTS

RESISTANCE AND MULTIPLIERS

This the relevant text........................

Code: Select all

\documentclass[10.5pt,english]{book}
\usepackage{fancybox,array,amsmath,amssymb,babel}
\usepackage[centering,
  headheight=14pt,
  headsep=10pt,
  includehead,
  papersize={18cm,24cm},
  text={15.25cm,19.2cm},
  dvips=false,
  pdftex=false,
  vtex=false]{geometry}
\usepackage[cam,a4,center,dvips]{crop}
\usepackage{graphicx,colortbl,textcomp,wrapfig}
\usepackage{fancyhdr,setspace}
\usepackage{ltxtable,tabularx,booktabs}
\fancyhf{}
\pagestyle{fancy}
\fancyhead[RO]{\small\fontfamily{phv}\textsc{Instrument Transformers}\hspace{15pt}\thepage}
\fancyhead[LE]{\thepage\hspace{15pt}\small\textsc{Electrical Measurements}}
%\fancyhead[LE,RO]{\thepage}
\headheight = 14pt
\headsep = 10pt
\hyphenpenalty=5000
% title formating %
\usepackage{titlesec}
\titleformat{\section}{\large \fontfamily{phv} \bfseries\uppercase}{\thesection}{1em}{\raggedbottom}
\titleformat{\subsection}{\fontfamily{phv}   
\fontsize{11}{27.5}\bfseries}{\thesubsection}{1em}{\raggedbottom}
\titleformat{\subsubsection}{\fontfamily{phv}   \bfseries}{\thesubsubsection}{1em}{\raggedbottom}
\titlespacing{\subsection}{0pt}{*2}{*1}
\titlespacing{\subsubsection}{0pt}{*2}{*1}


\begin{document}
\thispagestyle{empty}
\setcounter{chapter}{2}
\setcounter{secnumdepth}{3}
\setcounter{page}{1}

\section{Introduction}
A very general method of increasing the range of a.c. instruments is to use instrument transformers in.

\subsection{Advantages Of Instrument Transformers As Compared With Shunts And Multipliers}
A very general method of increasing the range of a.c. instruments is to use instrument transformers in.

\end{document}
Thanks in advance.

Regards,
Muthu

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

formatting subsection

Post by gmedina »

Hi, Muthu

change

Code: Select all

\titleformat{\subsection}{\fontfamily{phv}   
\fontsize{11}{27.5}\bfseries}{\thesubsection}{1em}{\raggedbottom}
to, for example,

Code: Select all

\titleformat{\subsection}{\fontfamily{phv}   
\fontsize{11}{14}\bfseries}{\thesubsection}{1em}{\raggedbottom}
Take into account that the second argument of \fontsize controls the distance between consecutive baselines.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
dmuthu_cse
Posts: 97
Joined: Fri Sep 04, 2009 4:56 pm

Re: formatting subsection

Post by dmuthu_cse »

Hello gmedina,

Thanks for suggestion.. It solved my problem.

I am very happy you are also given the tutorials related to that. That is very useful.

Thanks and regards,
Muthu
Post Reply