# [Tex/LaTex] what is the apostrophe symbol

typography

The following code

\documentclass[varwidth, margin = 1cm]{standalone}
\begin{document}
apostrophe '\\
apostrophe  as a Unicode character 2032 ^^^^2032\\ %requires xelatex
apostrophe in math mode $'$
\end{document}


gives the result

As one can see the apostrophe in free form, as a Unicode character 2032 and in math mode appears in different ways.

How can I produce an apostrophe similar to the one in math mode in a free text without using the awkward step of going into math mode?

If you want to use pdflatex:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}

\newcommand{\textprime}{\ensuremath{'}}
\newunicodechar{′}{\textprime}

\begin{document}

Arnol′d

$f'(x)$

\end{document}


Don't use ′ in math mode, unless it's for a single prime.

For XeLaTeX or LuaLaTeX:

\documentclass{article}
\usepackage{fontspec}
\usepackage{newunicodechar}

\setmainfont{Libertinus Serif}

\newcommand{\safeprime}{\ensuremath{'}}
\newunicodechar{′}{%
\iffontchar\font′′\else\safeprime\fi
}

\begin{document}

Arnol′d

\end{document}


The usage of \newunicodechar is a safety measure in case the font doesn't have the glyph corresponding to U+2032 PRIME.