TeX - LaTeX Asked by Barf on August 9, 2021
I’ve been using LaTeX for my math homework and notes for about 6 months now. However, I’m really quite new to anything that uses the real power of TeX.
When I used to do my homework by hand, I always meticulously crossed my z’s and 7’s, like this:
and likewise for my z’s.
Is there a way to make LaTeX automatically cross my 7’s and z’s (and capital Z’s, for that matter) within math mode? I’d like to leave the 7’s and z’s as normal within body text. ALso, I would prefer not to use a new command; I want a crossed 7 whenever I type 7 as normal, and likewise for Z/z.
My first idea for a solution would be to use the “negative space” command somewhat like this:
$7~-$
However, I’m not sure this is the most elegant solution, and I still don’t know how to make LaTeX do it automatically whenever I just type something like
$3+4 = 7.$
Thanks for any help anyone can offer!
Also I strongly recommend choosing a math font with such digits, or design one. For learning about TeX, and for using in math homework, I don't see a big problem, however consider not doing such things with possible side effects in an important document.
To answer your question, you could do it by making 7 and Z active characters in math mode, very similar to the answer of in Can (pdf)LaTeX recognize text strings and replace (expand) them.
documentclass[a4paper]{article}
begingrouplccode`~=`7lowercase{endgroup
edef~{rlap{noexpandtextbf{--}}mathcharthemathcode`7}}
mathcode`7="8000
begin{document}
The 7 crossed in only math mode: $3 + 4 = 7$
end{document}
Correct answer by Stefan Kottwitz on August 9, 2021
The simplest answer is: do not do this.
A longer answer: crossed or uncrossed 7's and z's are features of a font. A font designer spent hours and hours making his or her font aesthetically consistent, readable and pleasant. When you make this change, you basically overturn his or her decision; in most cases it looks just awful.
Answered by Boris on August 9, 2021
It is also possible with the stackinset
command, from with stackengine
:
documentclass[12pt]{article}%
usepackage{stackengine,} %
newcommand{hepta}{ensuremath{mathord{stackinset{c}{0.1ex}{c}{0pt}{-}{7}}}}
begin{document}
heptahepta
77
end{document}
Answered by Bernard on August 9, 2021
The Ƶ/ƶ is a separate letter in Unicode. There’s also a combining stroke overlay, 7̵ or 7̶, which in some fonts might display the way you want.
If there’s a font you can find with the stroked 7 and z, you can load it in math mode with unicode-math
or mathastext
. For example,
defaultfontfeatures{Scale=MatchLowercase}
setmaathfont{New Computer Modern Book Math}
setmathfont{SomeStrokedFont-Regular.otf}[range=up]
setmathfont{SomeStrokedFont-Italic.otf}[range=it]
Answered by Davislor on August 9, 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