Thursday, 02-May-2019 13:08:35 EDT

Proofreading `.tex` files is easier if Greek & math characters already appear as such there.
I used to deal with these characters using extended ASCII in Mac OS Roman encoding & viewing with my own font.
I replaced that with the more modern utf-8 (Unicode) & viewing with standard Unicode fonts.
(This approach works on all platforms.)
Utf-8 has 17×2¹⁶ characters, compared to the measly 2⁸-character extended ASCII, so this allows almost all math symbols, excluding super/subscripts (except for numerals & signs), to appear literally before processing.
So far it seems LuaLaTeχ is the most convenient for adding new characters: e.g.,
`\catcode`§=13 \def §{\section}`.

For (@ least) TeXShop on the Mac, the `.tex` source file would begin with (before `\documentclass`)

% !TEX program = lualatex % !TEX encoding = UTF-8 UnicodeThe 1st line is to automatically recognize the Teχ engine (to save you another button; you can also use "

Also, LaTeχ packages have already been written to recognize Unicode math, not just foreign languages: E.g., such a LuaLaTeχ file might begin

\documentclass[12pt]{article} \usepackage{amsmath} % needed for align & subeqs; must load before unicode-math \usepackage[math-style=ISO,colon=literal]{unicode-math} % \setmathfont{STIX Two Math} % most characters; Times-like % \setmainfont{XITS} % \setsansfont{TEX Gyre Heros}The unicode-math package is for recognizing (converting to Teχ) Unicode math. (

\AtBeginDocument{\directlua{require("combining_preprocessor.lua")}}Here are a few of the definitions I made for this: First, mostly to modify dots,

% accent over: \def\on#1#2{{\buildrel{{\mkern2.5mu\raise-.1em\hbox{$\scriptstyle#1$}\mkern-2.5mu}}\over{#2}}} \def\ron#1#2{{\buildrel{{\raise-.1em\hbox{$\scriptstyle#1$}}}\over{#2}}} % for unitalicized \def\dt#1{\on{\hbox{\bf .}}{#1}} % (big) dot over: see ̇ below \def\ddt#1{\on{\hbox{\bf .\kern-1pt.}}#1} % double dot: see ¨ below \def\under#1#2{\mathop{\null#2}\limits_{#1}} % accent underthen to allow Unicode typing of various characters, those math accents, & others:

% otherwise undefined utf-8 \catcode`〈=13 \def 〈{\langle} % Option-[ \catcode`〉=13 \def 〉{\rangle} % Option-] \catcode`❴=13 \def ❴{\{} % Option-{ \catcode`❵=13 \def ❵{\}} % Option-} \catcode`√=13 \def √{\sqrt} % Option-M \catcode`§=13 \def §{\section} % Option-i \catcode`¶=13 \def ¶{\subsection} % Option-I % spaces \catcode`⎵=13 \def ⎵{\nobreak\ } % Option-0 \catcode`⸏=13 \def ⸏{\quad} % Option-) %\catcode`␣=13 \def ␣{\TextOrMath{\thinspace}{\,}} % (open box) \catcode`˽=13 \def ˽{\TextOrMath{\thinspace}{\,}} % Option-space (modifier letter shelf) % combining characters \def\̂#1{\TextOrMath{#1̂}{\hat{#1}}} % Option-6 \def\̌#1{\TextOrMath{#1̌}{\check{#1}}} % Option-V \def\̃#1{\TextOrMath{#1̃}{\tilde{#1}}} % Option-n \def\́#1{\TextOrMath{#1́}{\acute{#1}}} % Option-~ \def\̀#1{\TextOrMath{#1̀}{\grave{#1}}} % Option-` \def\̇#1{\TextOrMath{#1̇}{\dt{#1}}} % Option-; \def\̈#1{\TextOrMath{#1̈}{\ddt{#1}}} % Option-: \def\̆#1{\TextOrMath{#1̆}{\breve{#1}}} \def\̄#1{\TextOrMath{#1̄}{\bar{#1}}} % Option-- \def\̊#1{\TextOrMath{#1̊}{\mathring{#1}}} % Option-A \def\⃗#1{\vec{#1}} % Option-R \def\⃡#1{\overleftrightarrow{#1}} % Option-E \def\⃖#1{\overleftarrow{#1}} % Option-W \def\̸#1{\slashed{#1}} % Option-/ % with single character only %\def\͞#1{\overline{#1}} % (combining double macron) \def\̅#1{\overline{#1}} % Option-? (combining overline) %\def\̱#1{\underline{#1}} % (combining macron below) \def\̲#1{\underline{#1}} % Option-_ (combining lowline) %\def\͡#1{\widehat{#1}} % (combining double inverted breve) \def\᷍#1{\widehat{#1}} % Option-^ (combining double circumflex above) \def\͠#1{\widetilde{#1}} % Option-N(The commented Option-characters are the way I type them with my keylayout: See my Unicode page for details.) Then α̇α̌ᾱα̃α̸... in the

\usepackage{hyperref} \hypersetup{ bookmarksnumbered, % (sub)section numbers in bookmarks unicode, % use with \texorpdfstring colorlinks, % avoid stupid boxes citecolor=[rgb]{.9,0,.5}, % \cite urlcolor=[rgb]{0,0,1}, % \href linkcolor=[rgb]{0,.7,0} % \ref , toc }

`\bibliographystyle{utphys}`

A recently improved version from Dharmesh Jain is hephys.bst.

To avoid doing `pdflatex, bibtex, pdflatex, pdflatex`, move the `latexmk` engine from `~/Library/TeXShop/Engines/Inactive/Latexmk/` to `.../Engines/`. The only menu item it will appear in is the `Program` list in the source window bar (so you'll need that button as well as the `Typeset` one).
Or begin the file with

%% !TEX program = latexmkSimilar remarks apply to lualatex & lualatexmk.

- In equation arrays, when aligning @ = signs, use
`&=`or`={}&`to get spacing right. \usepackage{cite} % for citations like [1-10] & not [1,2,3,4,5,6,7,8,9,10]

\usepackage{slashed} % Feynman: see ̸ above

\usepackage{microtype} % fewer hyphens, etc.

- Microtype presently has a bug
_{}, as revealed in an update (if you have) of`luaotfload`. It gives an error in luatex that ends in`l.59 \MT@lua{require("microtype")}`. The fix should appear shortly; in the meantime, precede its input with`\usepackage{luatexbase}`.

- Microtype presently has a bug
- For graphics files,
`\usepackage{graphicx}`, with commands like`\includegraphics[width=1.5in]{foo}`- or more simply, for pdftex, define commands like
\def\fig#1{\pdfximage {#1}\pdfrefximage\pdflastximage} \def\figscale#1#2{\pdfximage width#2 {#1}\pdfrefximage\pdflastximage}

- or for luatex
\def\fig#1{\saveimageresource {#1}\useimageresource\lastsavedimageresourceindex} \def\figscale#1#2{\saveimageresource width#2 {#1}\useimageresource\lastsavedimageresourceindex}

- If you want math/text alongside a figure, put it all in an equation,
and put the figure command inside
`\vcenter{\hbox{...}}`.

- To get equations numbered by subsection,
\catcode`@=11 \@addtoreset{equation}{section} \catcode`@=12 \numberwithin{equation}{subsection}

or just`\numberwithin{equation}{section}`for section. - Because I tire of typing environment commands:
\def\eq#1{\begin{equation}#1\end{equation}} \def\al#1{\begin{align}#1\end{align}} \def\se#1{\begin{subequations}\begin{align}#1\end{align}\end{subequations}} \def\ma#1{\begin{pmatrix}#1\end{pmatrix}}

`\pre`(⟂) isn't defined in`unicode-math`, so you have to use`\mathrel\bot`instead. This bug_{}has been known**for 8 yrs.**& still hasn't been fixed.

(For lualatex, take the "pdf" out of the \pagewidth & \pageheight commands, & replace \Huge with something like\documentclass[12pt]{article} % for landscape \pdfpagewidth=11in \pdfpageheight=8.5in \textwidth=10in \textheight=7.5in \topmargin=-1in \oddsidemargin=-.5in \evensidemargin=-.5in \parindent=0in % so people won't keep asking, "How much more do you have?" e.g., for 11 slides \setcounter{page}{-10} \begin{document} % big, bold, san serif \Huge\sffamily\bfseries\boldmath

You may also want the shield by itself for other purposes, so here's shield.pdf.