# How can I get three diacritics on the same Greek letter?

I'm working on a document where I need to (or at least would like to) write Ancient Greek text that has long alphas (indicated with a macron above) that also have breathing marks and accent marks. I can get any two of those at the same time pretty easily, but not all of them. So, is there any way to get a macron, accent mark, and breathing mark on the same Greek letter (in pdflatex)?. I'm mainly using \greektext for the Greek, but if you have an answer that uses math mode, that'll work too.

Edit

In response to David's comment, here's a MWE for the closest I can get to it. I can get all the diacritics in close proximity, but can only ever get two of them to combine.

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[polutonikogreek,english]{babel}
\usepackage{tipa}

\begin{document}

{\greektext >{\textipa{\'{\={\greektext a}}}}}

{\greektext {>{'\=a}}}

\end{document}

• please make it easier for people to help by adding a small complete document with a triple accent that fails to typeset correctly, so it is clear what packages/fonts you are using. (\greektext is not defined by default for example) Mar 29, 2017 at 18:17

The teubner package defines a more comprehensive set of macros for combined accents, compared with @egreg's answer. Here's Table 4 from the documentation (teubner-doc.pdf):

You can use the character combination already provided in the font:

\documentclass{article}
\usepackage[greek.polytoniko,english]{babel}

%\usepackage{fonttable}

\DeclareRobustCommand{\combinedaccent}[2]{%
\leavevmode\vbox{\offinterlineskip
\ialign{\hfil##\hfil\cr
\char#1\relax\cr
\noalign{\vskip -1ex}
\noalign{\vskip 0.1ex}
#2\cr
}%
}%
}
\newcommand{\lb}[1]{\combinedaccent{96}{\={#1}}}   % barys
\newcommand{\lo}[1]{\combinedaccent{39}{\={#1}}}   % oxys
\newcommand{\lob}[1]{\combinedaccent{126}{\={#1}}} % oxybareia
\newcommand{\ld}[1]{\combinedaccent{60}{\={#1}}}   % dasia
\newcommand{\ldb}[1]{\combinedaccent{67}{\={#1}}}  % dasia barys
\newcommand{\ldo}[1]{\combinedaccent{86}{\={#1}}}  % dasia oxys
\newcommand{\ldob}[1]{\combinedaccent{64}{\={#1}}} % dasia oxybareia
\newcommand{\lp}[1]{\combinedaccent{62}{\={#1}}}   % psilon
\newcommand{\lpb}[1]{\combinedaccent{95}{\={#1}}}  % psilon barys
\newcommand{\lpo}[1]{\combinedaccent{94}{\={#1}}}  % psilon oxys
\newcommand{\lpop}[1]{\combinedaccent{92}{\={#1}}} % psilon oxybareia

\begin{document}

\textgreek{\lb{a}\lo{a}\lob{a}\ld{a}\ldb{a}\ldo{a}\ldob{a}\lp{a}\lpb{a}\lpo{a}\lpop{a}}

\end{document}


I found two solutions (I don't know if your keyboard is in greek or you're just emulating greek symbols with the usual latin letters).

1. Keep in mind that this is not the optimal one, as it directly encodes Greek symbols, which sounds like trouble. I've only been able to find a partial solution because of tipa package that has some extra double-decked symbols.

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[greek]{babel}
\usepackage{tipa}

\begin{document}

\greektext{\textacutemacron{α}}

\end{document}


2. On the other hand, I can stack mathaccent symbols as much as I want, but it takes so many setup steps and inconvenient preparations that it is almost trivial. For example, your breathing mark only exists in XITS math font. This is my final result and the absolute best I can do. And just to mention, you have to compile the code with LuaLaTeX.

\documentclass{article}
\usepackage{unicode-math}
\usepackage{mathtools}
\setmathfont{XITS math}

\begin{document}
$\ocommatopright{\acute{\bar{\alpha}}}$
\end{document}