添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
仗义的柠檬  ·  Ubuntu Server ...·  1 月前    · 
发呆的作业本  ·  广东石油化工学院·  6 月前    · 
强悍的小刀  ·  盗窃罪量刑标准·  11 月前    · 

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Visit Stack Exchange

TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.

Sign up to join this community

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Copying the output with SumatraPDF even shows regular space characters between the letters and a line break between the words:

Hello World!
Hello World!
H e l l o
W o r l d !

(Copying it with Adobe Reader XI Win, however, yields three identical lines.)

This problem doesn't occur with LuaLaTeX:

The OCR-layer-text for LuaLaTeX is flawless as well, using either PDF viewer.

I assume this is a XeTeX bug? Can I circumvent it somehow?

I'm using MiKTeX 2.9, and version 2.33 of the DejaVu fonts, which I think came preinstalled with Windows (7), at least I can't recall manually installing these fonts. This version seems to be the current version, at any rate.

P.S.: If someone can recommend another monospaced font for code that a) goes well with Linux Libertine and b) contains lowercase Greek letters, that'd be helpful, too. But that just as an aside :).

A friend compiled my MWE on his MiKTeX 2.9 system and got the same result as I, so it might be MiKTeX-specific behavior? (Wouldn't surprise me for that kind of issue, intuitively.) – doncherry Nov 28, 2012 at 22:20 I have no problem with MikTeX 2.9, Win 7 but fresh downloads from the SF page of DeJaVu project. – percusse Nov 28, 2012 at 23:50

Have you tried specifying the fonts in more detail? I've tested the following in MiKTeX 2.9 without a problem.

\documentclass{article}
\usepackage{fontspec}
\defaultfontfeatures{
    Extension      = .ttf ,
    Ligatures      = TeX ,
    UprightFont    = * ,
    ItalicFont     = *-Oblique ,
    BoldFont       = *-Bold ,
    BoldItalicFont = *-BoldOblique
\setmainfont[ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic]{DejaVuSerif}
\setsansfont{DejaVuSans}
\setmonofont{DejaVuSansMono}
\begin{document}
Hello World!
\textsf{Hello World!}
\texttt{Hello World!}
\end{document}

You do need to have the dejavu package installed.

Silke, when the package dejavu not is installed, the font files will anyway only be found in the Windows fonts folder. The problem arises, when the package is installed, and perhaps no DejaVu font files in the Windows folder are existent. – Speravir Nov 29, 2012 at 19:13 Thanks! This works indeed, but I accepted my own answer because it solves the problem globally. (Also, sorry for the late response, I was pretty tied up the past weeks.) – doncherry Dec 21, 2012 at 22:21

The problem turned out to be more or less the same as in \setmainfont{Linux Libertine O} uses pfb files instead of otf: XeLaTeX didn't even use the Windows fonts, but the ones in the texmf tree (which for some reason seem to be flawed). The solution is the same as for the other question: Tell MiKTeX not to use those.

Here's how to do that:

Open your localfonts2.conf file. You may have several versions of this file in different places; the one that works for me is in C:\Users\doncherry\AppData\Roaming\MiKTeX\2.9\fontconfig\config (“Admin” MiKTeX installation). The file should look like this:

<?xml version="1.0"?>
<fontconfig>
  <selectfont>
    <rejectfont>
      <glob>C:/Program Files (x86)/MiKTeX 2.9/fonts/type1/public/dejavu/*</glob>
    </rejectfont>
  </selectfont>
</fontconfig>

With this configuration, everything works for me. According to Khaled Hosny, this specification will not be necessary anymore in the future, perhaps in MiKTeX 3.0.

Update:

While not using the Type1 fonts makes the problem go away, the Type 1 fonts still were buggy somehow. I contacted the author of the dejavu package; he identified the problem (too big Em Size) and said it would be fixed in a future version of the package.

The path written with a system variable: %APPDATA%\MiKTeX\2.9\fontconfig\config – and in a single user installation it is the same path. – Speravir Dec 21, 2012 at 22:45 Speaking of a new XeTeX version in MiKTeX: If we are lucky, we do not need to wait until MiKTeX 3.0, cf. my bug report XeLaTeX call strips parentheses in file name. – Speravir Dec 21, 2012 at 22:48