7

I have this code:

\documentclass{article}
\usepackage{fontspec}
\begin{document}
\setmainfont{DejaVu Serif}
"Heading"
\end{document}

(run with LuaLaTeX, texlive2105) which gives this result:

heading with italic quotes

But I'd like to have upright quotes. The font contains the upright quotes (glyph id 5), so it should be technically possible.

Torbjørn T.
  • 206,688
topskip
  • 37,020

3 Answers3

6

With the new luaotfload syntax for the definition of extra font features (from v2.7 on, I guess). Basically, we condone ligaturing the " to , but then have a font feature which substitutes back to ". It might also be possible to hook into the ligaturing callback to prevent this particular ligature.

Disclaimer: I have no idea what I'm doing.

\documentclass{article}
\usepackage{fontspec}
\directlua{
fonts.handlers.otf.addfeature {
    name = "altquot",
    {
        type = "substitution",
        data = {
            ["”"] = "\string\"",
        }
    }
}
}
\begin{document}
\setmainfont[RawFeature=+altquot]{DejaVu Serif}
"Heading" -- ---
\end{document}

enter image description here

Henri Menke
  • 109,596
  • This also disables \enquote{fobar} (package csquotes). – topskip Jun 26 '16 at 20:13
  • @topskip Well, it simply substitutes all occurences of to ", no matter where they come from. It is not a question of input, but a question of output. The substitution is applied on typesetting, i.e., everything that typesets as will be converted to ". – Henri Menke Jul 04 '16 at 07:22
3

You want to disable the automatic Ligatures=TeX feature:

\documentclass{article}
\usepackage{fontspec}

\defaultfontfeatures[\rmfamily]{}
\setmainfont{DejaVu Serif}

\begin{document}

"Heading"

\end{document}

enter image description here

egreg
  • 1,121,712
  • This also disables -- and --- (and perhaps others I'm not aware of). – Henri Menke Jun 26 '16 at 12:44
  • @HenriMenke Yes, of course. If one wants only some TeX standard ligatures, a new map file is needed. – egreg Jun 26 '16 at 12:47
  • I knew about the TeX ligatures, but I did not know that they were activated by default and how to disable them. This ansers my question (including the -- and --- ligatures). Thanks! – topskip Jun 26 '16 at 13:15
3

@topskip: Start using ConTeXt again! Other TeX ligatures (-- and ---) are enabled by default, quotes are not!

\setupbodyfont[dejavu]
\starttext
"Heading"
\stoptext

enter image description here

Aditya
  • 62,301
  • I like ConTeXt and this project would benefit from using ConTeXt. But I am not the only one involved in it, I won't be able to persuade others to participate... – topskip Jun 26 '16 at 20:15