TeX - LaTeX Asked on July 16, 2021
Imagine that I need to place inside the text an example of how a section heading looks like. I.e. I need to format a line of text exactly the way a section heading is formatted, but without starting a new section.
The best I could do is this:
documentclass[12pt, paper = B5]{scrbook}
usepackage{xcolor}
KOMAoptions{headings = big}
addtokomafont{section}{color{red}}
begin{document}
section*{Real section heading}
Here is how section heading looks like:
usekomafont{section}
sectionlinesformat{section}{0pt}{}{Simulated section heading}
end{document}
Which produce this:
and is not what I want. It misses the font settings, beforeskip, and afterskip.
Any ideas?
You are missing usekomafont{disposition}
. The space before and after headings are not inserted by sectionlinesformat
. You would have to insert them manually.
But you could define a new heading command with the same settings as section:
documentclass[12pt, paper = B5]{scrbook}
usepackage{xcolor}
KOMAoptions{headings = big}
addtokomafont{section}{color{red}}
makeatletter
DeclareNewSectionCommand[
style=section,
level=sectionnumdepth,
tocstyle=gobble,% there will be no ToC entry
beforeskip=scr@section@beforeskip,
afterskip=scr@section@afterskip,
font=usekomafont{section},
]{mysection}
makeatother
begin{document}
Some text
section*{Real section heading}
Here is how section heading looks like:
mysection*{Simulated section heading}
More text
end{document}
mysection
or mysection*
will not reset counters and not change or clear running heads.
Correct answer by esdd on July 16, 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