168

I want to get that fancy LaTeX symbol to put in one of my documents but I cannot find it anywhere. All searching for things like latex symbol have not resulted in the symbol but other symbols.

Stefan Kottwitz
  • 231,401

3 Answers3

171

You simply type \LaTeX. One problem with this is that if you type it a lot of times in your text you will need to type \LaTeX\␣¹ (i.e., followed by \ and an actual space) to force a space after it.

Also personally I find the capitalization of L and T leads to typing errors, so I redefine the command as follows:

\newcommand{\latex}{\LaTeX\xspace}
\newcommand{\tex}{\TeX\xspace}

\xspace is from the xspace package. Additionaly, writing \LaTeX{} adds the space after.


¹ is used here to represent a normal space "", which wouldn’t show up at the end of Markdown code markup.

yannisl
  • 117,160
  • 8
    or simply \makeatletter\g@addto@macro{\TeX}{\xspace}\makeatother for both –  Dec 22 '10 at 06:33
  • 5
    Or \expandafter\def\expandafter\TeX\expandafter{\TeX\xspace} or \edef\TeX{\TeX\noexpand\xspace} or ... – TH. Dec 22 '10 at 10:29
  • Why is the extra slash needed to force a space? – 8128 Jan 28 '14 at 22:49
  • 2
    @fluteflute It is the way TeX is designed. Imagine if you needed to type \LaTeX. then the space would be a problem. – yannisl Jan 29 '14 at 02:36
  • 5
    You could use \LaTeX{} instead of the "\ ". The curly brackets indicate the empty arguments list. LaTeX does know that the command ends and does not eat up the following space. – usr1234567 Aug 05 '16 at 07:32
  • 1
    Downvoted, this answer is bad. People should use just \LaTeX{}. – Tvde1 Feb 11 '19 at 14:26
  • 3
    @Tvde1 Thanks for the downvote. You care to explain why in an answer? It is perfectly acceptable to do either. In the first case, \ was terminated by \, the command that produces an interword space. It can also be terminated by the empty group { }. Note the empty group not the empty argument as mentioned by @usr1234567. The solution I propose going lowercase and xparse, saves a lot of typing if you typing notes for LaTeX. – yannisl Feb 13 '19 at 16:45
  • Yes, the command \LaTex {} works the best. Just a heads-up that, use the aforementioned command within closed bow brackets. – Aditya Dec 09 '23 at 15:14
25

There is also the hologo package for typesetting TeX-related logos:

\hologo{LaTeX}
\Hologo{LaTeX}  % to be used at the beginning of a sentence (no difference in this case)

While the syntax is a bit more verbose, it has the advantages that you don't have to think about trailing spaces and that it works correctly inside PDF bookmarks.

Philipp
  • 17,641
19

Use the following

% !TEX encoding = UTF-8 Unicode
\documentclass[UTF8]{article}
\begin{document}

\LaTeX

\end{document}

you will get

latex logo

Notice that there are three capital letters in the command.

zyy
  • 2,146
  • 2
    I am afraid I can not agree. This way is simpler than others, no packages required, no special commands. I am here just to help. Also, every time I have a problem, I will come to Stack Exchange for help, if I did not find what I want, I will search other resources. This is why I posted this, I would like to share the idea that works for me from other places to the community. – zyy Mar 09 '16 at 17:02
  • 2
    But it's exactly the same answer as is given in the first one except that the first one then goes on to show you how to correct the problems you will have if you write \LaTeX is good. Have you tried that? You will find that there will be no space between the LaTeX logo and is – Au101 Mar 09 '16 at 17:06
  • 2
    Sorry, I completely overlooked that. I thought he was talking about something else. Sorry for that. – zyy Mar 13 '16 at 04:11
  • That's alright, don't worry, you're more than welcome to participate and, yeah, sharing something that works that isn't covered by other solutions is exactly what we're for. Okay, you overlooked something this time, it's alright, it happens. Don't beat yourself up. But, absolutely, it's important to try not to duplicate answers and this is all the more true on a really old finished question. Stackexchange allows us to always go back to old questions when we need to because things may change. Adding a new answer to an old question is fine. But adding nothing to an old Q is a problem – Au101 Mar 13 '16 at 04:23
  • 3
    This answer has a nice illustration that helps viewers understand the kind of symbol they'll be getting. I often search by keyword + image and thus this answer gets picked up where others do not. Worth a vote from me. :-) – PatrickT Jun 27 '20 at 06:41