29

I need to cite the journal "Sankhyā: The Indian Journal of Statistics" in a paper. I would like to draw the ā character properly (i.e., I'd prefer, if possible, to avoid using some hack, such as \bar or \overline).

Question: How do I properly write ā in LaTeX?

I didn't have luck with Detexify (after several attempts in both in capital and lowercase) nor The Comprehensive LATEX Symbol List (searching the file for "ā" and "india" revealed no hits).

Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036
Rebecca J. Stones
  • 1,439
  • 2
  • 11
  • 22

2 Answers2

54

You can write the macron using \=<character>;

\documentclass{article}
\usepackage[T1]{fontenc}

\begin{document}

Sankhy\=a

\end{document}

enter image description here

Just for the record, here's a table I wrote some time ago, containing (I think) all the accents provided by LaTeX (the original names were in Spanish; I used the English names I found on the web, but let me know if there's any mistakes):

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[USenglish]{babel}
\usepackage{fourier}
\usepackage{booktabs}
\usepackage{listings}

\lstset{
basicstyle=\small\ttfamily}

\begin{document}

{
\renewcommand\arraystretch{1.3}
\noindent\begin{tabular}{@{}clcc@{}} 
    \toprule & &
    \multicolumn{2}{c@{}}{Example}\\ 
    \cmidrule(l){3-4}
    Definition &
    \multicolumn{1}{@{}c}{Description} &
    Input &
    Output \\
    \cmidrule(r){1-1}\cmidrule(r){2-2}\cmidrule(l){3-3}\cmidrule(l){4-4}
    \lstinline+\'{<character>}+ & acute accent & \lstinline+\'{a}+ & \'{a}\\
    \lstinline+\`{<character>}+ & grave accent & \lstinline+\`{a}+ & \`{a}\\
    \lstinline+\"{<character>}+ & umlaut or dieresis & \lstinline+\"{u}+ & \"{u}\\
    \lstinline+\c{<character>}+ & cedilla &\lstinline+\c{c}+ & \c{c}\\
    \lstinline+\={<character>}+ & macron & \lstinline+\={a}+ & \={a}\\ 
    \lstinline+\b{<character>}+ & bar under &\lstinline+\b{a}+ & \b{a}\\ 
    \lstinline+\u{<character>}+ & breve accent &\lstinline+\u{a}+ & \u{a}\\ 
    \lstinline+\v{<character>}+ & há\v{c}ek &\lstinline+\v{a}+ & \v{a}\\
    \lstinline+\~{<character>}+ & tilde & \lstinline+\~{n}+ & \~{n}\\
    \lstinline+\^{<character>}+ & circumflex accent & \lstinline+\^{o}+ & \^{o}\\ 
    \lstinline+\.{<character>}+ & dot accent &\lstinline+\.{a}+ & \.{a}\\ 
    \lstinline+\d{<character>}+ & dot-under accent &\lstinline+\d{a}+ & \d{a}\\ 
    \lstinline+\r{<character>}+ & ring &\lstinline+\r{a}+ & \r{a}\\
    \lstinline+\H{<character>}+ & long Hungarian umlaut &\lstinline+\H{a}+ & \H{a}\\
    \lstinline+\k{<character>}+ & ogonek &\lstinline+\k{a}+ & \k{a}\\ 
    \lstinline+\t{<character>}+ & tie-after accent &\lstinline+\t{oo}+ & \t{oo}\\ 
    \bottomrule
  \end{tabular}
  } 

\end{document}

enter image description here

As egreg mentions in his comment, Accents over the "i" deserve special mention: `i , \'i, \^i and \"i produce the desired accent, but \i must be used for the others, for instance \={\i} or \v{\i}.

Of course, some of the accents can be obtained loading the inputenc package and typing them directly from the keyboard.

Thanks to Mico for suggesting the addition of the ogonek.

Gonzalo Medina
  • 505,128
  • Even if you can access it on your keyboard, the character is not set up for use as a unicode character through inputenc so this would still be the out-of-the-box way to get the accent. – cfr Mar 05 '14 at 00:03
  • @cfr Yes, you're right. I was just checking that. I'll delete the superfluous part from my answer. – Gonzalo Medina Mar 05 '14 at 00:05
  • 1
    Will the character be "selectable" in the pdf? – pluton Mar 05 '14 at 01:40
  • 2
    @pluton some of them will, some won't. The first four tigether with the tilde, the circumflex and the ring will be "copyable" from the PDF; the others won't. – Gonzalo Medina Mar 05 '14 at 02:02
  • 1
    Why is the ring uppercase? – Pål GD Mar 05 '14 at 10:29
  • @PålGD A small typo in the table. I used a lowercase "a" in the input part, but an uppercase "A" in the output. I'll fix it. Thanks for noticing it. – Gonzalo Medina Mar 05 '14 at 13:08
  • 1
    You might add that the common accents over “i” can be input as \\i,'i,^iand"i, but\imust be used for the others (for instance={\i}`). – egreg Mar 05 '14 at 16:50
  • @egreg It's a good suggestion. I'll add it in some minutes. Thanks. – Gonzalo Medina Mar 05 '14 at 17:21
  • 2
    I'd like to nominated the "ogonek" symbol, e.g., \k{a}, for inclusion in this fine table. – Mico Mar 05 '14 at 20:45
  • @Mico +1 for nominating Polish "ogonek" (i.e., roughly speaking, "small tail"). Polak bez ogonka / W pisaniu się błąka (It means: A Pole without "ogonek" strays in his writing. Alas, without rhymes in English version). – Przemysław Scherwentke Jul 14 '14 at 03:45
5

Use the unicode character!

With pdflatex you then have to add \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc}, with lualatex or xetex \usepackage{fontspec}. Your source file has to be encoded like this of course.

pdflatex

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}
Sankhyā
\end{document}

xelatex or lualatex

\documentclass{article}

\usepackage{fontspec}

\begin{document}
Sankhyā
\end{document}

Character input

There are several ways to directly input unicode characters that are not on your keyboard.

  • editors provide tools for it, e.g. with vim you can press ctrl + k and insert a key kombination, e.g. a* for α.

  • Compose Key. Most Unix Systems provide a Compose Key, that lets you input characters by pressing certain key combination if you press a special key. If you define Caps lock to be your compose key, you can type caps lock a - to get ā. Most of these combinations are rather intuitive, so you do not have to lokk them up. E.g. you get → by pressing compose - > or € by pressing compose C =.

  • enter unicode hex code, for windows press alt u and enter the unicode hex code, for e.g. ubuntu press ctrl alt u and enter the hex code. The unicode postion of ā is U+0101.

MaxNoe
  • 6,136
  • For Mac OS X (US Extended keyboard), ALT-a + letter: āēīōūȳs̄ḹṝḡ – egreg Feb 03 '15 at 17:33
  • You have to be careful with Unicode. There are issues with ᾿ (Greek psili) that is turned into an accented ligature where it is not supposed to, e.g. Κατ᾿ ἐμαυτοῦ – sophros Dec 09 '20 at 20:38