[Tex/LaTex] The best way to define greek letters in text mode

greekpdftex

I would like to know which way is suited for defining a greek letter in text mode (e.g. delta). Is it:

\newcommand{\deltat} {\ensuremath{\delta}} and you have to use \deltat instead of \delta

or

\usepackage{letltxmacro}
\LetLtxMacro{\old}{\delta}
\renewcommand{\delta}{\ensuremath{\old}}

Best Answer

What about...

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\DeclareUnicodeCharacter{3B4}{\ensuremath{\delta}}

% use http://shapecatcher.com/ to find the char
% or https://w3c.github.io/xml-entities/unicode-names.html

\begin{document}

This is  δ.

\end{document}

$delta$ !

(to find the code, you use a plain δ in your input, and you have the nice error:

lalla.tex|12 error| Package inputenc Error: Unicode char δ (U+3B4)

...letting TeX itself telling you the code).

If what you want is a text-like delta:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp,upgreek}
\DeclareUnicodeCharacter{3B4}{\ensuremath{\updelta}}

% use http://shapecatcher.com/ to find the char
% or https://w3c.github.io/xml-entities/unicode-names.html

\begin{document}

This is  δ.

\end{document}

enter image description here

Clearly, you need a nice way to input it: I have a personal keymap that let me use AltGr to emit all the greek unicode letters...

Clearly, this is just for typing the odd Greek letter alone in math mode inside text. For even a bit more complex formulas, using $...$ is better; and for typing Greek extensively, you should use babel and/or the unicode engines with an appropriate font. (Thanks to David for the tip).