3

I want to write an article with fontsize 11pt. I have problem to change fontsize of title is 14pt and abstract fontsize 9pt.

This is my code :

\documentclass[11pt,a4paper]{article}
\usepackage[left=3.00cm, right=2.00cm, bottom=2.00cm, top=2.00cm]{geometry}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\RequirePackage[english,bahasa]{babel}
\RequirePackage{times}
\RequirePackage{setspace}
\RequirePackage{indentfirst}

\RequirePackage{graphicx,latexsym}
\RequirePackage{amssymb}
\RequirePackage{amsfonts}
\RequirePackage{amstext}
\RequirePackage{amsmath}
\RequirePackage{amsthm}
\RequirePackage{listings}
\RequirePackage{color}
\RequirePackage{float}
\RequirePackage{longtable}
\RequirePackage{enumerate}
\RequirePackage{multirow}
\RequirePackage[center,font=footnotesize,labelfont=bf,textfont=bf,labelsep=space,aboveskip=1.5ex,singlelinecheck=off]{caption}
\RequirePackage{pdfpages}
\RequirePackage{fancyhdr}
\RequirePackage{tikz}
\RequirePackage{cases}
\usepackage{ragged2e}
\usetikzlibrary{matrix,arrows,shapes.geometric}
\allowdisplaybreaks
\RequirePackage{natbib}
\bibliographystyle{plainnat}

\renewcommand{\baselinestretch}{1}
\parskip0.15cm

\renewcommand{\normalsize}{\fontsize{11bp}{12bp}\selectfont}
\frenchspacing

\usepackage{graphicx}
\usepackage{graphics}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{pgf,tikz}
%\usepackage[bahasa]{babel}
\usepackage{enumitem}
\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{pgf,tikz}
\usepackage[bahasa]{babel}
\usepackage{titlesec}
\titleformat{\section}
{\normalfont\fontsize{11}{15}\bfseries}{\thesection}{1em}{}
%\renewcommand{\thesection}{\thechapter\arabic{section}.}

\titleformat{\section}                                     
{\bfseries}
{\thesection.}{1em}{}
\titleformat{\subsection}                                   
{\slshape\bfseries}
{\thesubsection.}{1em}{}

\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}%[section]
\newtheorem{definition}[theorem]{Definition}%[section]
\newtheorem{example}[theorem]{Example}
\begin{document}
\begin{center}
\textbf{TITLE, I WANT FONTSIZE 14pt}\\\vspace{0.3cm}
\textbf{Full name}\\\vspace{0.3cm}
\textit{Institution}\\\vspace{0.1cm}
\textit{e-mail: \textcolor{blue}{\underline{.....@yahoo.com}}}
\end{center}
\textbf{\textit{Abstract.}} I want abstract's fontsize 9pt\\ \\
\textit{\textbf{Keywords}: blabla1,blabla2.}
\vspace{-0.5cm}
\section{INTRODUCTION}\vspace{-0.45cm}
hello hello hello
\section{SECTION TWO}\vspace{-0.45cm}
\begin{theorem}
    theorem ...
\end{theorem}

\end{document}

and this is the result : enter image description here

How to change fontsize of title and abstract?

  • 3
    \fontsize{14pt}{16pt}\selectfont \fontsize{9pt}{11pt}\selectfont. You really should prune your preamble - it is going to cause you no end of headaches. Also, times is long deprecated and shouldn't be used. – cfr Jul 15 '18 at 0:39
  • 1
    It’s a bad idea to copy-and-paste long lists of packages from someone else’s template. You have many packages loaded multiple times! I’d recommend you wipe the entire list of packages, then put back in: 1: unicode-math instead of any other font or symbol packages. If you want Times, \setmainfont{TeX Gyre Termes} and \setmathfont{TeX Gyre Termes Math}. Put back any packages you know why you need. Once. Then add back the minimum packages you need to fix all the errors in your source, including wrong output. – Davislor Jul 15 '18 at 2:11
  • 1
    ok, i have type \begingroup \fontsize{14pt}{16pt}\selectfont title \endgroup in my editor and it worked perfect. – Ongky Denny Wijaya Jul 15 '18 at 2:29
  • 1
    By the way, an alternative is to use a \documentclass such as scrartcl or memoir that allows you to declare the font to use for your title and abstract. Kind of overkill if you’re using them in one place. @cfr, you want to make yours an answer? – Davislor Jul 15 '18 at 3:00
  • 1
    @Davislor If the OP is using XeTeX or LuaTeX to compile, that advice is reasonable (although unicode-math is buggy), but not for TeX or pdfTeX. – cfr Jul 15 '18 at 3:44
2

The preamble is really a mess and also produces errors. Start with a minimal one and add only the packages you really need.

\documentclass[11pt,a4paper]{article}
\usepackage[left=3.00cm, right=2.00cm, bottom=2.00cm, top=2.00cm]{geometry}
\usepackage[english,bahasa]{babel}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{titlesec}

\usepackage{newtxtext,newtxmath} % not times

\titleformat{\section}                                     
  {\bfseries}
  {\thesection.}
  {1em}
  {}
\titleformat{\subsection}                                   
  {\slshape\bfseries}
  {\thesubsection.}
  {1em}
  {}

\newtheorem{theorem}{Theorem}

% change the abstract
\renewenvironment{abstract}{%
  \quotation
  \footnotesize
  \textbf{\textit{\abstractname.}} % with a normal space
}{\endquotation}


\begin{document}
\begin{center}
\fontsize{14}{17}\selectfont
\textbf{TITLE, I WANT FONTSIZE 14pt}

\vspace{0.3cm}

\normalsize

\textbf{Full name}

\vspace{0.3cm}

\textit{Institution}

\vspace{0.1cm}

\textit{e-mail: \textcolor{blue}{\underline{.....@yahoo.com}}}
\end{center}

\begin{abstract}\footnotesize
I want abstract's fontsize 9pt

\bigskip

\textit{\textbf{Keywords}: blabla1,blabla2.}
\end{abstract}

\section{INTRODUCTION}

hello hello hello

\section{SECTION TWO}

hello hello hello

\subsection{Subsection}

\begin{theorem}
    theorem ...
\end{theorem}

\end{document}

If you want less space after the section titles, act with \titlespacing, not with manual \vspace after them.

enter image description here

The settings \tolerance=1 and \hyphenpenalty=10000 just make for huge interword spaces and very low quality typesetting.

1

The simple workaround is from a comment by @cfr, but here’s a solution that simplifies your preamble a lot and uses some of the default formatting commands.

\documentclass[11pt]{article} % instead of \renewcommand\normalsize.
\usepackage{unicode-math} % This replaces every other symbol package you used.
% It also loads fontspec.
\usepackage{polyglossia}
\usepackage{amsmath, amsthm} % You do not need amsfonts or amssymb if you
% load unicode-math.  You could let mathtools load amsmath for you.
\usepackage[HTML, svgnames, table]{xcolor} % Replaces color, loads colortbl.
\usepackage[compact]{titlesec}
%\usepackage{tikz} % Not actually used in this MWE, but you probably really do
% need this for something.
%\usepackage{natbib} % Another that you don’t actually use in this MWE but prob-
% ably are in your real document.

% \usetikzlibrary{} goes here

\setmainfont{TeX Gyre Termes} % You had loaded times.
\defaultfontfeatures{Scale=MatchUppercase}
\setmathfont{TeX Gyre Termes Math}
\setmonofont{Inconsolata}
%\setsansfont{TeX Gyre Heros}

\setdefaultlanguage{english}
\setotherlanguage{indonesian}

% You might need to set this:
% \newfontfamily\indonesianfont[Language=Indonesian]{TeX Gyre Termes}

\titleformat{\section}                                     
{\bfseries\scshape}
{\thesection.}{1em}{}
\titlespacing*{\section}{0pt}{*2.0}{*-0.5}

\titleformat{\subsection}                                   
{\itshape\bfseries}
{\thesubsection.}{1em}{}
\titlespacing*{\subsection}{0pt}{*1.0}{*-0.5}

\renewcommand{\thesubsection}{\thesection\arabic{subsection}}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}%[section]
\newtheorem{definition}[theorem]{Definition}%[section]
\newtheorem{example}[theorem]{Example}

% If you don’t like the defailt size, you can replace \Large with
%   \fontsize{14pt}{16pt}\selectfont
\title{\textbf{\textsc{\Large Title: I Want Font Size 14pt}}}

\author{Full Name\thanks{\textcolor{blue}{\texttt{\underline{...@yahoo.com}}}}\\
  \textit{Institution}}

\begin{document}

\maketitle

\begin{abstract}
\footnotesize
% Or: \fontsize{9pt}{11pt}\selectfont%
I want the abstract’s font size to be 9pt.
\end{abstract}

\section{Introduction}
Hello hello hello

\section{Section Two}
\begin{theorem}
    theorem ...
\end{theorem}

\end{document}

Sample Document

I’ve taken some liberties with the layout, which you’ll change if you feel like it. In particular, the email address is now a footnote, which I cropped out to fit as an image here. You can easily put it on its own line by changing \thanks{} to \\, or put it in parentheses after your name. I went with Polyglossia for this, but Babel would work just fine too. Since you loaded titlesec anyway, I used \titlespacing* in the preamble to replace the manual negative \vspace after every title, and I went ahead and changed all-caps to small caps.

I also had the new prelude upgrade to unicode-math. That’s not a universal recommendation here: you will see @cfr (who is very knowledgeable about NFSS and the author of several important packages) arguing against it because it still has bugs. While this is true, it can do many things that no combination of legacy packages can, and all current development in mathematical typesetting uses the technologies it supports. There are still rare special cases where it’s not the right tool for the job, but it’s gotten to the point where those are exactly that: rare special cases.

If you do want to use legacy NFSS packages, you probably want either tgtermes or newtx as your Times clone. If you don’t really have a strong preference for Times at all, but just copied that package into your preamble, there are many great alternatives; I personally like Asana Math with Palatino as the text font.

The other change is that I scaled the measurements to the default font size, which is now selected as a package option, rather than using units such as points or centimeters. That is, the main title is two sizes larger and the abstract two sizes smaller, which should still work if you change the font size to 10 or 12 point. The spacing before and after sections and subsections is also relative.

If you want to have full control over the point size, and you’re sure that’s not an XY problem, I left in comments with those commands. (@cfr posted them first.)

  • 1
    Are you sure that Inconsolata is a suitable as the argument of \setsansfont, i.e., suitable as a general-purpose text font? I would use Inconsolata mainly as the argument of \setmonofont. – Mico Jul 15 '18 at 8:03
  • 1
    @Mico \setsansfont{Inconsolata} should indeed have been \setmonofont. (I changed the email address to monospaced.) Well-spotted! – Davislor Jul 15 '18 at 14:54
  • 1
    Remove the braces inside the abstract environment. They disrupt the line spacing pertaining to \footnotesize. – egreg Jul 15 '18 at 15:22
  • 1
    @egret Thanks! Will do later. (Croatia just scored!) – Davislor Jul 15 '18 at 15:30
  • 1
    @Mico Well, I wasn't before. (Live in the US, born in Belgium.) – Davislor Jul 15 '18 at 16:07

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.