{"id":493,"date":"2010-06-09T15:12:42","date_gmt":"2010-06-09T15:12:42","guid":{"rendered":"http:\/\/math.columbia.edu\/~dejong\/wordpress\/?p=493"},"modified":"2010-06-09T15:12:42","modified_gmt":"2010-06-09T15:12:42","slug":"forward-and-inverse-search","status":"publish","type":"post","link":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/?p=493","title":{"rendered":"Forward and inverse search"},"content":{"rendered":"<p>If you use gvim and xdvi to edit and view your latex and corresponding dvi files then you can set it up so that you can jump effortlessly back and forth between the location in the dvi viewer and the location in the editor. This is explained on <a href=\"http:\/\/xdvi.sourceforge.net\/inverse-search.html\">this webpage<\/a>, but I wanted to rephrase it here.<\/p>\n<p>Firstly, in order for inverse search to work you have to use<br \/>\n<code>latex -src filename.tex<\/code><br \/>\nwhen compiling your latex files. The make command in the stacks project does this automatically for you. The default is that control + left button in the xdvi window brings you to the corresponding place in the editor. If this isn&#8217;t working you need to check if a line such as<br \/>\n<code>xdvi.editor: gvim --servername xdvi --remote +%l %f<\/code><br \/>\noccurs in the file .xdvirc (which is probably somewhere in your home directory). If not then try to see if your xdvi lets you set it (in the options\/preferences), else you can edit .xdvirc directly.<\/p>\n<p>Secondly, to use forward search place the following line<br \/>\n<code>map &lt;F3&gt; :execute \"!xdvi  -sourceposition \" . line(\".\") . expand(\"%\") . \" \" . expand(\"%:r\") . \".dvi\"&lt;CR&gt;&lt;CR&gt;<\/code><br \/>\nin your .gvimrc file (in your home directory). Having done this then when you press F3 in gvim you will jump to the corresponding place in xdvi.<\/p>\n<p>There is still a minor issue with this if you are editing multiple files concurrently (in tabs of gvim). Namely, in that case case a new instance of xdvi pops up if you use F3 after you switch to editing another file in gvim. (If you switch files using ctrl-click in the corresponding xdvi window this doesn&#8217;t happen.) This is a small price to pay for the convenience.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you use gvim and xdvi to edit and view your latex and corresponding dvi files then you can set it up so that you can jump effortlessly back and forth between the location in the dvi viewer and the &hellip; <a href=\"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/?p=493\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-493","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/493","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=493"}],"version-history":[{"count":17,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions"}],"predecessor-version":[{"id":510,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/493\/revisions\/510"}],"wp:attachment":[{"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=493"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=493"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.math.columbia.edu\/~dejong\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=493"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}