TeX - LaTeX Asked by Grabinuo on April 20, 2021
How do I remove the spacing between Chapter and its name?
CHAPTER#
CHAPTER NAME
to
CHAPTER#
CHAPTER NAME
I have tried using
titleformat{chapter}[display]{fontsize{20}{24}selectfontbfseriescentering}{CHAPTER thechapter}{-5mm}{}[]
But, for long titles that will expand to multiple lines the spacing will be inconsistent. You can see the spacing between CHAPTER 1 and LONG CHAPTER THAT WILL CAUSE THIS ISSUE. How do I fix this? And make the content of the title close to the chapter number without inconsistency.
Here is a MWE
documentclass[12pt,a4paper]{report}
usepackage[utf8]{inputenc}
usepackage{parskip}
usepackage{fontspec}
usepackage{inputenc}
usepackage[T1]{fontenc}
usepackage{amssymb} % MATH SYMBOLS
usepackage{anyfontsize} % Font size
usepackage{titlesec} % Title format
usepackage{setspace} % setting stretch
usepackage{geometry} % Paper margins
usepackage{fancyhdr} % Fix page numbering
%================================================================
% FONT SETTING
%================================================================
geometry{a4paper,left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm}
setstretch{1.15}
setlength{parindent}{0em}
setlength{parskip}{8pt}
linespread{1.08}
renewcommand{baselinestretch}{1.08}
setmainfont{Times New Roman}
%================================================================
% TITLE SETTING
%================================================================
titleformat{chapter}[display]{fontsize{20}{24}selectfontbfseriescentering}{CHAPTER
thechapter}{-5mm}{}[]
titleformat{section}
{fontsize{14}{16.8}selectfontbf}
{thesection.}{0.5em}{}
titleformat{subsection}
{fontsize{13}{18.2}bf}
{thesubsection.}{0.5em}{}
titlespacing{section}{0in}{12pt}{8pt}
titlespacing{chapter}{0cm}{0cm}{0cm}
titlespacing{subsection}{0in}{12pt}{8pt}
%================================================================
% NAMES IN title/names_super
%================================================================
begin{document}
chapter{LONG CHAPTER THAT WILL CAUSE THIS ISSUE}
end{document}
That vertical space that seems wrong to you is actually correct. What is wrong is the space after "CHAPTER 1". This is partly due to your definition of chapter
and partly due to the use of the parskip
package (or redefining parskip
to 8pt).
I used the fontsize
package to change the normal size and line spacing. By using fontspec
, however, you can also act differently.
Below is a mwe:
documentclass[12pt,a4paper]{report}
usepackage[skip=8pt]{parskip}
usepackage{titlesec} % Title format
usepackage{geometry} % Paper margins
geometry{a4paper,left=2.54cm,right=2.54cm,top=2.54cm,bottom=2.54cm}
usepackage{fontspec}
setmainfont{Times New Roman}
%================================================================
% FONT SETTING
%================================================================
usepackage{fontsize}
changefontsize[16.2]{12}
%================================================================
% TITLE SETTING
%================================================================
titleformat{chapter}[display]{%
parskip=0pt
fontsize{20}{24}selectfontbfseriescentering}{CHAPTER
thechapter}
{0mm}
{}
titleformat{section}
{fontsize{14}{16.8}selectfontbf}
{thesection.}
{0.5em}
{}
titleformat{subsection}
{fontsize{13}{18.2}bf}
{thesubsection.}
{0.5em}
{}
titlespacing{section}{0in}{12pt}{8pt}
titlespacing{chapter}{0cm}{0cm}{0cm}
titlespacing{subsection}{0in}{12pt}{8pt}
%================================================================
% NAMES IN title/names_super
%================================================================
usepackage{lipsum}
begin{document}
chapter{LONG CHAPTER THAT WILL CAUSE THIS ISSUE}
lipsum
end{document}
Answered by Ivan on April 20, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP