The Prime Symbol

Assorted ways of entering and rendering the troublesome prime symbol.

One issue is in math mode. A typesetter has to account for how different fonts position their prime symbols.

Another problem crops up in text where quotes marks get used for things like feet and inch units in lengths or minute and second units in latitude and longitude coordinates. It should be possible to not trigger smart quotes in these cases.

typst

Download: ( source | pdf )

Input document

#set page(
  paper: "a7",
  margin: 4mm,
)
#set text(
    font: "Libertinus Serif",
    size: 12pt,
)
#show par: set block(spacing: 1em)
#show math.equation: set block(spacing: .8em)
#show math.equation: set par(leading: .4em)

Math mode manners:

#[
    #show math.equation: set text(font: "STIX Two Math", size: 16pt)
    $
        f(x) &= a' + b'' + c''' \
        f'(x) &= x^2 + 1
    $
]

#[
    #show math.equation: set text(font: "Libertinus Math", size: 16pt)
    $
        f(x) &= a' + b'' + c''' \
        f'(x) &= x^2 + 1
    $
]

Prose poses problems:

60*10'16"N 24*55'52"E (plain)\
60°10′16″N 24°55′52″E (unicode)\
60#[#sym.degree]10#[#sym.prime]16#[#sym.prime.double]N 24#[#sym.degree]55#[#sym.prime]52#[#sym.prime.double]E (idiomatic)\

Render command

typst compile prime-symbol-typst.typ prime-symbol-typst.pdf

sile

Download: ( source | pdf )

Input document

\begin[papersize=a7]{document}
\nofolios
\neverindent
\font[family=Libertinus Serif,size=12pt]
\use[module=packages.math]
\set[parameter=math.font.size,value=16]

Math mode manners:

\set[parameter=math.font.family,value=STIX Two Math]
\begin[mode=display]{math}
	\table[columnalign=right left]{
		f(x) &= a\prime  + b\dprime + c\trprime \\
		f\prime(x) &= x^2 + 1
	}
\end{math}

\set[parameter=math.font.family,value=Libertinus Math]
\begin[mode=display]{math}
	\table[columnalign=right left]{
		f(x) &= a\prime  + b\dprime + c\trprime \\
		f\prime(x) &= x^2 + 1
	}
\end{math}

Prose poses problems:
\medskip

\begin{raggedright}
	60*10'16"N 24*55'52"E (plain)\break
	60°10′16″N 24°55′52″E (unicode)\break
	60°10′16″N 24°55′52″E (idiomatic)
\end{raggedright}

\end{document}

Render command

sile -o prime-symbol-sile.pdf prime-symbol-sile.sil

xelatex

Download: ( source | pdf )

Input document

\documentclass{article}
\usepackage[paperheight=105mm,paperwidth=74mm,margin=4mm]{geometry}
\pagenumbering{gobble}
\setlength{\parindent}{0pt}
\usepackage{libertinus}
\usepackage{fontspec}
\usepackage{relsize}
\usepackage{unicode-math}
\usepackage{siunitx}
\begin{document}
\fontsize{12}{16}
\selectfont

Math mode manners:
\setmathfont{STIX Two Math}
\[\mathlarger{\begin{aligned}
	f(x) & = a\prime + b\dprime + c\trprime \\
	f\prime(x) & = x^{2} + 1
\end{aligned}}\]

\setmathfont{Libertinus Math}
\[\mathlarger{\begin{aligned}
	f(x) & = a\prime + b\dprime + c\trprime \\
	f\prime(x) & = x^{2} + 1
\end{aligned}}\]

Prose poses problems:
\smallskip

\raggedright{
	60*10'16"N 24*55'52"E (plain)\break
	60°10′16″N 24°55′52″E (unicode)\break
	\ang{60;10;16}N \ang{24;55;52}E (idiomatic)
}

\end{document}

Render command

xelatex -interaction=batchmode -halt-on-error -jobname data/prime-symbol-xelatex prime-symbol-xelatex.tex

groff

Download: ( source | pdf )

Input document

.nr HM .4cm
.nr PO .4cm
.nr LL 6.2cm
.nr PI 0
.nr PS 12p
.nr VS 18p
\# TODO convert OpenType fonts to something groff can use
.fam P
.LP
Math mode manners:
.LG
.LG
.EQ C
f(x) mark = a' + b'' + c'''
.EN
.LG
.LG
.EQ C
f'(x) lineup = x sup 2 + 1
.EN
\# TODO complete prime input test with two fonts
.LP
Prose poses problems:
.LP
60*10'16"N 24*55'52"E (plain)
.br
60°10′16″N 24°55′52″E (unicode)
.br
60\[de]10\[fm]16\[sd]N 24\[de]55\[fm]52\[sd]E (idiomatic)

Render command

groff -ms -e -P-pA7 -T pdf prime-symbol-groff.ms > prime-symbol-groff.pdf