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).

3
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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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