8

I want to write in latex a text at which there are some lemmas.

So we could use the command

\begin{Lemma}
...
\end{Lemma} 

right??

Could we write instead of "Lemma" something in greek??

When I write

\begin{\textgreek{Λήμμα}}
    ...
\end{\textgreek{Λήμμα}} 

I get an error...

What could I do??

David Carlisle
  • 757,742
Mary Star
  • 347
  • 2
    Welcome to TeX.SE. How is the Lemma environment defined? Do you load any packages, such as amsthm and ntheorem, that facilitate the creation of theorem-like environments? Which LaTeX format do you use: pdfLaTeX, XeLaTeX, LuaLaTeX, or something else? – Mico Apr 13 '15 at 03:23
  • 1
    Why would you do that? The text from \begin{<anything>} and \end{<anything>} will not appear in the output (as opposed to what is written inbetween those two commands), and you could define any environment to include the word "lemma" (in Greek) as you pleased.... – jon Apr 13 '15 at 03:24
  • Can someone explain to me what is unclear about this question? I realize it shows lack of some LaTeX knowledge, but this itself doesn't make it unclear. – yo' Apr 22 '15 at 05:59

2 Answers2

19

You could do it with XeLaTeX or LuaLaTeX, but not with pdfLaTeX.

The reason is that TeX (on which pdfTeX is based) was born before Unicode was thought of. So TeX doesn't understand Unicode natively and this causes some “problems”.

Let's look at the Unicode character Λ U+039B GREEK CAPITAL LETTER LAMDA. When your editor is set up for UTF-8 and you type Λ, the editor actually records two characters (better, bytes) in the file: <CE><9B>. Any Unicode compliant program that reads the same file, would recognize the byte <CE> as a UTF-8 prefix for a two-byte encoded character, look at the next byte and, after finding <9B>, it would interpret the pair of bytes as Λ as if it had been a unique character to begin with.

With TeX the situation is different. It can't interpret two, three or four byte UTF-8 characters as if they had been one from the start, because TeX just knows bytes. So, upon finding <CE><9B> it doesn't know more than these two bytes.

Fortunately, TeX understands macro definitions, which can be used to emulate UTF-8. Any character can be made into a macro and indeed, \usepackage[utf8]{inputenc} makes the <CE> byte into a macro. This macro absorbs the next token and from it it produces some other macro; in the case of <CE><9B> the macro produced is \textLambda, which is later interpreted to print a capital lambda.

As a consequence, your desired \begin{Λήμμα} would hand TeX not a sequence of characters to interpret in order to find the name of the environment, but a sequence of instructions to print a word in the Greek alphabet.

When \begin{lemma} is found, the macro \lemma is executed (defined when \newtheorem{lemma} had been processed). With pdfLaTeX it's not possible to have \begin{Λήμμα} without giving up at several more useful constructs.

It's not really difficult to set up \newtheorem so that \newtheorem{Λήμμα}{Λήμμα} is accepted and even to redefine \begin so that \begin{Λήμμα} is interpreted correctly. However, this would break several packages: the pros and cons balance leans too much towards the cons side.

You can do

\newtheorem{Λήμμα}{Λήμμα}

and

\begin{Λήμμα}
...
\end{Λήμμα}

if you use XeLaTeX or LuaLaTeX for processing your document. However, I see no real advantage in doing so: code reusability is much more important, in my opinion.


Just to make things clearer: you can do

\newtheorem{lemma}{Λήμμα}

with any engine (provided Greek support is enabled if the engine is pdfLaTeX). The printed label can be anything printable. The symbolic label, used in the source code, should be ASCII characters.

egreg
  • 1,121,712
11

I'm going to guess that what you really want is to see the word "Λήμμα" in your formatted document; how to get it there is not particularly important. As @egreg explained in his answer, it's not easy to include non-English characters in the definition of command names. Fortunately the amsthm package (which presumably you're using, if you are using \newtheorem) makes it possible to do what you want without using Greek in macro names.

The command \newtheorem has the syntax: \newtheorem{commandname}{Displayed name}. Use it to define your own lemma environment, like this:

    \newtheorem{mylemma}{Λήμμα}

Use whatever name you want instead of mylemma, but use only English letters. If your document is set up to handle Greek in the regular text (in the "body" of your document), this definition should Just Work. Then you just type \begin{mylemma} instead of \begin{Lemma}, and you'll see Λήμμα 1 etc. in your document.

Incidentally, if you want to write text in Greek, you must switch to XeTeX or LuaTeX (I don't know enough to compare them, but either one will do). Especially if you're new to latex, which I'm guessing you are. It's simply not worth figuring out how to make pdftex work with unicode, when the alternatives are so much more robust for this purpose (and let you use your favorite Greek fonts).

Edit: Here's a minimal compilable example, since you seem unsure how to use the theorem environment. (Needs to be compiled with XeLaTeX.) Please use a version of such an example if you have questions in the future.

\documentclass{article}

\usepackage{amsthm}
\newtheorem{mylemma}{Λήμμα}

\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}

\begin{document}    
\begin{mylemma}
x = x
\end{mylemma}

\begin{mylemma}
y = y
\end{mylemma}
\end{document}
alexis
  • 7,961
  • 1
    it's not amsmath that provides \newtheorem, it's amsthm. (but if one is writing theorems, they're probably also indulging in math, so loading both packages is a good idea.) – barbara beeton Apr 13 '15 at 20:13
  • Oops, thanks! Dropped the reference to amsmath. – alexis Apr 14 '15 at 13:00
  • 2
    good try, but if i were a newbie, i wouldn't have the foggiest idea what the "ams system" might be. (even as an employee of ams, i'm not really sure.) "the amsthm package", on the other hand, should be clear in latex terminology. – barbara beeton Apr 14 '15 at 19:18
  • Ok, I'll take your advice on this. The OP must know what I meant but other readers could indeed have no idea. – alexis Apr 14 '15 at 20:12
  • Thank you!! I have also two other questions. 1)If we want to write more than one Lemmas do we have to write the following? \newtheorem{mylemma1}{Λήμμα 1.} \ \begin{mylemma1} $A(x,y)>y$ \end{mylemma1} \ \newtheorem{mylemma2}{Λήμμα 2.} \ \begin{mylemma2} $A(x,y+1)>A(x,y)$ \end{mylemma2} ... or is there a specific command for that?? 2) When we write the command \newtheorem{mylemma1}{Λήμμα 1.} \ \begin{mylemma1} $A(x,y)>y$ \end{mylemma1} , "A(x,y)>y" appears the line under "Λήμμα 1.". Could we write it also at the same line?? @alexis – Mary Star Apr 15 '15 at 23:11
  • @Mary, theorem environments handle their own numbering. You'll only need to use \newtheorem once for all lemmas, and you should put the definition in your preamble, before \begin{document}. Try it out! – alexis Apr 16 '15 at 13:30
  • Also: (a) Digits cannot be part of latex macro names; {mylemma} is fine, but {mylemma1} should give you an error. (b) Use a blank line, not \\\ between paragraphs. – alexis Apr 16 '15 at 13:32
  • (c) The lemma environment is already in math mode. How have you been using it? – alexis Apr 16 '15 at 13:41
  • You might want to change the font to something evailable with TeX Live and MikTeX, for example TeX Gyre Termes. – Johannes_B Apr 16 '15 at 14:02
  • Sure, why not. But I trust the OP already has a basic set-up working. – alexis Apr 16 '15 at 14:26
  • So, do I have to write the following??

    \newtheorem{mylemma}{Λήμμα}

    \begin{mylemma} $A(x,y)>y$ \end{mylemma}

    \begin{mylemma} $A(x,y+1)>A(x,y)$ \end{mylemma}

    \begin{mylemma} Αν $y_2>y_1$, τότε $A(x,y_2)>A(x,y_1)$. \end{mylemma}

    \begin{mylemma} $A(x+1, y) \geq A(x,y+1)$ \end{mylemma}

    \begin{mylemma} $A(x,y)>x$ \end{mylemma}

    \begin{mylemma} Αν $x_2>x_1$, τότε $A(x_2, y)>A(x_1, y)$. \end{mylemma}

    \begin{mylemma} $A(x+2, y)>A(x, 2y)$ \end{mylemma}

    @alexis

    – Mary Star Apr 16 '15 at 17:50
  • Or have I understood it wrong?? Because there isn't the numbering... @Johannes_B – Mary Star Apr 16 '15 at 17:50
  • @MaryStar copying and compiling the example in this answer, what do you get? – Johannes_B Apr 16 '15 at 18:49
  • @Mary, no you don't have to write that. See my revised answer. If your lemmas are not numbered, you're not using amsthm. What are you using? Add a simplified (minimal) example to your answer -- not to a comment. – alexis Apr 16 '15 at 20:47