Lined section header
| 2021-3-7
0  |  阅读时长 0 分钟
Tags
title lettering
LaTeX used
frac
fcolorbox
substack
difficulty/replicability
intermediate

Example use in a page

notion image

Equation

Light mode
Dark mode
Play around with changing the page to and from wide mode, the title will be centered in wide mode and off center in thin mode.

Code

Put this code inside a block equation (block equation instead of in-line equation for cetering)
Explanation. Make the text large with \Large so it looks heading-sized. Start a substack to stack things above each other. Set the color of the horizontal line using \color{color code here}, here I used #E90163 which is fuchsia. Then make the horizontal line by making a fraction \frac{}{} and filling the numerator with whitespace \hspace{600px}. Changing the 600px to another number will change it's length. This will affect the alignment of the title in thin pages and will change the line length in wide pages (the reason being in thin mode there's secretly a lot more line than you can see but it's going off the frame). Then start the next line of the substack \\ and shift it up [-0.9em] to lie above the fuchsia line. You'll have to adjust the -0.9em amount if you use a font size other than \Large. We make a background box for the title to make part of the horizontal line disappear behind it with \fcolorbox{framecolor}{fillcolor}{box content} where in light mode we use white for both edge and fill and in dark mode we use the dark mode background color #303538 for both. You can also change the frame color if you want, for instance
frame-less was just my personal preference.
Loading...
目录