I want to be able to use d-hat (d with a caret (^) above it) in emacs to indicate an estimate of Cohen's 'd' (an effect size statistic).

How can I enter this in org-mode in a way that it renders within emacs, and also how can I make sure it exports out to latex/PDF?


EDIT: Below are a tex file that resulted from a LaTeX export of a one-line org file, with the latex output

% Created 2020-09-17 Thu 16:09
% Intended LaTeX compiler: pdflatex
 pdfcreator={Emacs 26.3 (Org mode 9.1.9)},


This is a d-hat: \(\hat{d}\)
$ latex test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 20.6.29)
entering extended mode
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-07-17>
("C:\Program Files\MiKTeX\tex/latex/base\article.cls"
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
("C:\Program Files\MiKTeX\tex/latex/base\size11.clo"))
("C:\Program Files\MiKTeX\tex/latex/base\inputenc.sty")
("C:\Program Files\MiKTeX\tex/latex/base\fontenc.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics\graphicx.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics\keyval.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics\graphics.sty"
("C:\Program Files\MiKTeX\tex/latex/graphics\trig.sty")
("C:\Program Files\MiKTeX\tex/latex/graphics-cfg\graphics.cfg")
("C:\Program Files\MiKTeX\tex/latex/graphics-def\dvips.def")))
y) (C:\Users\brett\AppData\Roaming\MiKTeX\tex/generic/pdfescape\pdfescape.sty)
("C:\Program Files\MiKTeX\tex/latex/hyperref\pd1enc.def")
("C:\Program Files\MiKTeX\tex/latex/url\url.sty")
("C:\Program Files\MiKTeX\tex/latex/hyperref\hdvips.def"
("C:\Program Files\MiKTeX\tex/latex/hyperref\pdfmark.def"
sty (C:\Users\brett\AppData\Roaming\MiKTeX\tex/latex/atveryend\atveryend.sty)
! Undefined control sequence.
<argument> U-BRXPS\brett

l.26  pdflang={English}}

  • The problem is the backslash in the author name: it is interpreted as the macro \brett by LaTeX which is not defined. Can you use \author{U-BRXPS/brett or some such?
    – NickD
    Sep 17, 2020 at 12:01

1 Answer 1


If there is a Unicode d-hat, then using that should take care of it both in the buffer and in the PDF produced through LaTeX (assuming your LaTeX tool chain can handle Unicode, which should be no problem nowadays).

Unfortunately, I can't find such a Unicode character. In the absence of that, I would suggest you use a LaTeX math expression:


which will produce a d-hat in the output. But it's not going to look like a d-hat in the buffer, unless you preview the LaTeX fragment with M-x org-latex-fragment (usually bound to C-c C-x C-l) - this is a toggle, so repeating it will eliminate the overlay and show you the LaTeX fragment again. You can preview all the LaTeX fragments in your buffer with C-u C-u C-c C-x C-l and if you want that to happen whenever you open the file, you can add a Local File Variables section at the end of your file:

# Local Variables:
# eval: (org-latex-fragment '(16))
# End:

This last trick is a general Emacs customization trick, applicable generally, not just for Org mode stuff.

See Embedded LaTeX in the manual. In the long run, if you have to do a lot of math, then learning some LaTeX and using this embedding is likely to be a more productive way to produce your documents.

  • Thanks, this is great to know. I'm running Emacs from Cygwin on Windows and when I attempt to preview LaTeX fragments, I get the following error: Creating image... org-compile-file: File "/cygdrive/c/Users/brett/AppData/Local/Temp/orgtexG4MJNr.dvi" wasn’t produced. Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’.Unable to load color "PaleYellow". Any thoughts? Sep 14, 2020 at 19:16
  • You may be missing dvipng or perhaps some other piece of the LaTeX chain. Can you go from a .tex file to a .dvi file (with latex foo.tex) and then from the dvi file to a png file (with dvipng foo.dvi) on the command line?
    – NickD
    Sep 14, 2020 at 19:31
  • Thanks Nick. I have both those packages. I ran latex/dvipng on another file with no maths in it and it ran fine. However on my maths file, the latex command won't generate the DVI file. It's hard to paste entire output here but it ends with "! Undefined control sequence." right after loading "uniquecounter.sty" and there is no DVI output. This is probably outside the scope of this question but I'm open to keep testing if you have ideas. Sep 15, 2020 at 20:33
  • Maybe you can update your question and add the log that is produced (or at least a few lines around the error) and the tex file that you are trying to process (or again a few lines around whatever causes the error).
    – NickD
    Sep 15, 2020 at 21:41
  • Added to original post Sep 17, 2020 at 6:13

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.