1
\documentclass{article}
\newcommand{\sect}[1]{\section{\fontsize{20}{30}\selectfont \ctxfr #1}}

\begin{document}
\sect{Yes}

\end{document}

Above is what I tried; it is unfortunately not workable ('\ctxfr' is to specify a certain font).

Yes
  • 1,639
  • Is this relevant: http://tex.stackexchange.com/questions/36609/formatting-section-titles – jak123 Oct 22 '15 at 06:07
  • @jak123 Thank you; I tried that, which did not work in my case. :) But maybe it is because I was not "copying" it right... – Yes Oct 22 '15 at 06:11
  • @jak123 Sorry; I mis-typed the stuff that I tried; please refer to the present version if you are still willing; thanks! – Yes Oct 22 '15 at 06:19

1 Answers1

3

There are quite a few options for this. First with sectsty package.

\documentclass{article}
\usepackage{lmodern}
\usepackage{sectsty}
\sectionfont{\fontfamily{phv}\fontsize{20}{30}\selectfont}

\begin{document}
\section{Yes}
Some text here

\end{document}

For font sizes like 20, you need a scalable font like lmodern The phv font family is used for demo.

Now with titlesec

\documentclass{article}
\usepackage{lmodern}
\usepackage{titlesec}
\titleformat*{\section}{\fontfamily{phv}\fontsize{20}{30}\selectfont\bfseries}

\begin{document}
\section{Yes}
Some text here

\end{document}

Please note that the \titleformat* is the short hand version. The enhanced version will be like below:

\documentclass{article}
\usepackage{lmodern}
\usepackage{titlesec}
\titleformat{\section}
  {\fontfamily{phv}\fontsize{20}{30}\selectfont\bfseries}{\thesection}{1em}{}


\begin{document}
\section{Yes}
Some text here

\end{document}

The raw deal will be to change the original defintion manually.

\documentclass{article}
\usepackage{lmodern}
\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\fontfamily{phv}\fontsize{20}{30}\selectfont\bfseries}}  %% this line changed
\makeatother

\begin{document}
\section{Yes}
Some text here

\end{document}