Sunday, 07-Nov-2021 15:33:18 EST

TEX

Unicode

arXiv.org doesn't know how to deal with XɘTeX or LuaTeχ. (They can't even handle pdftex unless it's pdflatex. But they finally updated their TeXLive distribution from 2016 to 2020.) Until they figure it out, I'll submit just my pdf files. Meanwhile, here are my LuaLaTeχ papers (@ least the parts typed by me take advantage of Unicode):
  1. Open F-branes (2110.13010)
  2. Chiral string theories as an interpolation between strings and particles (2109.10401)
  3. S-matrices from 4d worldvolume (2012.12938)
  4. F-theory amplitudes (2010.14590)
  5. F-theory superspace backgrounds (1910.01710)
  6. O(D,D) gauge fields in the T-dual string Lagrangian (1810.04761)

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 Unicode
The 1st line is to automatically recognize the Teχ engine (to save you another button; you can also use "TS-program" instead of "program"): Move the lualatex engine from ~/Library/TeXShop/Engines/Inactive/LuaTeX/ to .../Engines/. The 2nd is for file encoding (if utf-8 isn't already your default). Don't forget to set Edit > Substitutions > Text Replacement (using settings in System Preferences > Keyboard > Text).

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. (math-style=ISO is an option to make capital Greek "italic". colon=literal keeps math colons like text colons.) The commented font commands would be for output in Times New Roman-like fonts, rather than the default Computer Modern-like fonts Latin Modern. (The Teχ standard Computer Modern fonts are not Unicode, although there are "Computer Modern Unicode" fonts. STIX Two Text has optical size 10, and so is less elegant than standard Times New Roman clones like XITS.)

a-Shell

a-Shell is a free Terminal app for i(Pad)OS that does (Lua)Teχ. If you use an external source editor (as I do), you can almost completely avoid the Command Line Interface. Then the only commands you actually need to type are: Also, tab ⇥ will complete the command name, & also the filename. Furthermore, instead of repeating typing, just use the up arrow key ↑ to cycle through previous commands.

But I wanted a little customization: To use an iCloud folder for personal texinputs (incl. luainputs), you need to put a .profile (suggested by the author) something like this in ~/Documents in the a-Shell sandbox (the folder where a-Shell starts):

jump inputs
cd -
setenv TEXINPUTS .:/private/var/mobile/Library/Mobile\ Documents/com~apple~CloudDocs/Documents/tex/inputs//:
setenv LUAINPUTS .:/private/var/mobile/Library/Mobile\ Documents/com~apple~CloudDocs/Documents/tex/inputs//:
setenv BIBINPUTS .:/private/var/mobile/Library/Mobile\ Documents/com~apple~CloudDocs/Documents/tex/inputs/bib//:
setenv BSTINPUTS .:/private/var/mobile/Library/Mobile\ Documents/com~apple~CloudDocs/Documents/tex/inputs/bst//:
alias b bibtex
alias f pickFolder
alias j jump
alias l lualatex
alias p pwd
alias s showmarks
where /Documents/tex/inputs/ is where I located my texinputs in iCloud, & inputs is the bookmark made when I used pickFolder to go there. (Note that folder/filenames with spaces need \'s: " " → "\ ".) This was facilitated by a few Unixy commands: Miscellany:

Math accents, etc.

There is also the problem that Unicode has you type accents after the letter, while Teχ wants them before. (Consider, e.g., δ̇.) With LuaLaTeχ, you can solve the problem with a Lua script, which essentially solves the problem in math the way it's already solved in text. Include a file for that script, & input it with the line
\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 under
then to allow Unicode typing of various characters, those math accents, & others:
% otherwise undefined utf-8

\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 .tex source comes out that way in the pdf.

Hyperref

hyperref is the standard macro package in LaTeX for adding links, etc. Some useful options (with sample colors):
\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
	}
unicode is for using the macro \texorpdfstring{ }{ } in (sub)section headings, for the few cases not already covered by unicode-math (or your macros), where the former argument is for the tex to make it appear in the usual way in the body (e.g., {\LARGE$\bigcirc$}\hskip-.2in{\normalsize$\ddot\smile$}) & the latter for code to make it appear as unicode in the bookmarks (e.g., 🙂).

BibTEX

Whereas non-standard tex inputs need to be put somewhere in ~/Library/texmf/tex/, bibtex .bst files need to go in ~/Library/texmf/bibtex/bst/, & .bib files in ~/Library/texmf/bibtex/bib/. A nice choice for .bst is

\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 = latexmk
Similar remarks apply to lualatex & lualatexmk.

Miscellaneous LaTeX stuff

Slides

There are many fancy ways to do presentations, with or without TeX. If you want to be simplistic, you can do it in pdfLaTeX without special packages with just a few lines:
\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
(For lualatex, take the "pdf" out of the \pagewidth & \pageheight commands, & replace \Huge with something like \fontsize{27pt}{36pt}\selectfont .)

Local stuff

Stony Brook logo & letterhead: template.tex, letterhead.tex, & shieldlogo.pdf. (As usual, for TeXShop, put them somewhere in ~/Library/texmf/tex.)

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