# SyncTeX points to a wrong location in source or preview document

I have the following pretty simple document:

\documentclass[11pt]{article}
\usepackage{xltxtra}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{polyglossia}
\setmainlanguage{russian}
\setotherlanguage{english}
\setmainfont[Mapping=tex-text]{Linux Libertine}

\begin{document}

\section{Выражения}

\subsection{Числовые выражения}

Решим задачу: Туристы в течение двух часов ехали на велосипеде по шоссе
со скоростью 16~км/ч, а затем шли лесом еще 7~км. Какова длина всего
маршрута?''

\end{document}


I use TeXworks. When I compile the document with XeLaTeX and then Ctrl + click on either the source or preview it highlights the corresponding line incorrectly. What can be wrong here?

Also I tried the same in Texmaker and it also synchronizes preview with source incorrectly.

-
I am not able to compile this as it seems that the font Linux Libertine is not part of the standard TeXLive2011 distribution. –  Peter Grill Nov 17 '11 at 16:20
@PeterGrill: I'd say that Linux Libertine is indeed a part of TL2011. But the font name should be Linux Libertine O. –  Leo Liu Nov 17 '11 at 17:27
@Maxim: Well, everything is OK on my computer. (with TeXworks) –  Leo Liu Nov 17 '11 at 17:30
@LeoLiu It's strange. You said that Linux Libertine is part of TexLive installation, but when I try to use Linux Libertine O it throws "The font "Linux Libertine O" cannot be found.". I installed Linux Libertine from their site and it is accessible as Linux Libertine (without O at the end). So probably something wrong with my fonts or something like that? I am just a noob in the TeX world... –  Maxim Nov 17 '11 at 18:11
@Maxim: Please read the document of TeX Live 2011, "3.4 Post-install actions" -> "3.4.4 Font configuration for XeTeX" –  Leo Liu Nov 17 '11 at 18:14

Note (added 2012-07-17). The bug has been fixed in TeX Live 2012

I can only confirm the bad behavior, at least on Mac OS X. It seems that the synchronization with XeTeX is off by one paragraph. I've checked with other documents and different pairs of editor/previewer.

The bug seems to have been introduced with the 2011 TeX Live, as synchronization works when the document is compiled with the 2010 binaries.

A minimal document exhibiting the problem is

\documentclass{article}
\begin{document}
1 par

2 par
\end{document}


Clicking on 1par in the source jumps to the left corner of the (absent) headline, while 2par jumps to the right corner. Clicking either on "1 par" or "2 par" in the PDF jumps after \end{document} in the source.

-
Is it font-specific? Can a minimal example be made with plain XeTeX (to make sure it isn't a bug cause by the various packages Maxim loads)? –  Bruno Le Floch Jan 8 '12 at 5:21
This looks OK in TL2012: could you check? –  Joseph Wright Jul 17 '12 at 15:09
I didn't realize I was running an old version of TeX Live. I'll check it out. If this does prove to be the solution, @JosephWright, you should make your comment an answer - I don't know if you get the bounty credit for community wiki –  keflavich Jul 23 '12 at 15:49