TeX - LaTeX Asked on June 19, 2021
Good day!
I am creating a title "Translation dB, dBm"
Now I want to put this header in the header using "fancyhdr", but it prints all letters in all caps. This is good, and I like it, but dB becomes DB, and this is already a mistake.
The question is: is it possible to somehow indicate that dB does not become all capital letters (DB), and let the rest of the text remain in large letters.
documentclass[a4paper,12pt]{article}
usepackage{cmap}
usepackage[T2A]{fontenc}
usepackage[utf8]{inputenc}
usepackage[english,russian]{babel}
usepackage{caption}
usepackage{fancyhdr}
pagestyle{fancy}
begin{document}
tableofcontents
clearpage
section{Translation dB, dBm}
end{document}
The fancyhdr
package does provide a nouppercase
command that turns the capitalization it normally does off.
To get something like you want, here’s a bit of a hack. Load fontaxes
, which provide textsc
to select small caps and textulc
to turn small caps off. Then load a font that contains a Cyrillic small caps face.¹
With the fontaxes
package, you can select the primary shape (such as slanted) and the secondary shape (such as small caps) separately. It gives you textsc
and textulc
commands to turn small caps on and off. This lets you combine slanted text, like in the default fancy
page style, with small caps text—and specify individual words that should not be in small caps with textulc{dB}
.
I also took a few other liberties, such as turning on the [twopage]
option, turning on microtype
, and loading Unicode fonts in engines that support them.
documentclass[a4paper,12pt,english,russian,twoside]{article}
usepackage{iftex}
iftutex
usepackage{babel}
usepackage{unicode-math}
defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX}
babelfont{rm}[Ligatures=Common, Language=Default, Scale=1.0]{Erewhon}
babelfont{sf}[Ligatures={Common,Discretionary}, Language=Default]{Libertinus Sans}
babelfont{tt}[Language=Default]{Libertinus Mono}
setmathfont{Erewhon Math}
else
usepackage[T2A,T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{cmap}
usepackage{babel}
% Loads a Type 1 font family that supports Cyrillic slanted small caps,
% along with a matching math font, a sans-serif font and a typewriter font.
usepackage{libertinus-type1}
usepackage{fourier, erewhon}
usepackage{fontaxes} % For textsc, textulc, etc.
fi
usepackage{caption}
usepackage{microtype}
usepackage{fancyhdr}
babeltags{english=english}
pagestyle{fancy}
renewcommand{sectionmark}[1]{markright{arabic{section}.~textsc{#1}}}
fancyhead[LO,RE]{{slshapescshapeselectfontnouppercase{leftmark}}}
begin{document}
tableofcontents
clearpage
begin{english}
section{Translation textulc{dB}, textulc{dBm}}
end{english}
end{document}
¹ As of 2020, the following 8-bit font families define a {scsl}
NFSS shape for the {T2A}
ecoding: Libertinus, Erewhon, Garamond Libre, XCharter, Noto, and Old Standard. Several of those do not actually work.
Correct answer by Davislor on June 19, 2021
Many thanks! It works! It seems to me that there is a lot of unnecessary here. Here is the minimum that continues to work. However, the word "content" is repeated on every page, although this is not necessary, and the inscriptions in the footer are located on the left and then on the right, that is, in a bookish manner. Fixing that would be great!
documentclass[a4paper,12pt,english,russian,twoside]{article}
usepackage{iftex}
iftutex
fi
usepackage{fancyhdr}
pagestyle{fancy}
renewcommand{sectionmark}[1]{markright{arabic{section}.~textsc{#1}}}
begin{document}
tableofcontents
clearpage
section{Translation textulc{dB}, textulc{dBm}}
newpage
section{Translation textulc{dBtrr}, textulc{dBmerer}}
end{document}
Answered by Антон on June 19, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP