2

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}}
  • 4
    I actually find it simpler just to type $\delta$ in text mode. Welcome to the site. – Steven B. Segletes Nov 12 '18 at 17:37
  • But I would like to make \delta in text, it's 2 fewer symbols tho. – Bast Nov 12 '18 at 17:47
  • 2
    If keystrokes were the issue, you could \newcommand\?{\ensuremath{\delta}}...but would that really make your document readable? I don't recommend it. – Steven B. Segletes Nov 12 '18 at 17:50
  • 2
    Consider foo \delta{} bar vs foo $\delta$ bar. That is the exact same number of keystrokes. – Henri Menke Nov 12 '18 at 18:35
  • 2
    your question isn't clear, do you want to enter a mathematical greek variablem s $\delta$ or do you actually want to type Greek Γειά σου Κόσμε the math Greek font is unsuitable for text use just as $hello\ world$ is not a suitable fromt to type text italic. – David Carlisle Nov 12 '18 at 21:53
2

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).

  • 2
    you should make it clear that this is only for mathematical Greek, with single letter variables, for textual greek you'd want the LGR font encoding not T1 and probably babel greek support for hyphenation etc. – David Carlisle Nov 12 '18 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.