Supporting Source Specials?



Hi,

I am maintainer of AUCTeX <URL:http://www.gnu.org/software/auctex>, a
TeX/LaTeX editing mode for Emacs.  For several years, TeX has been
supporting the command line option "-src-specials" which embeds
"Source specials" into the DVI file.  Specials are elements that carry
positional information for the backend.

AUCTeX now has a "Source Specials" mode in which it will call both TeX
and the previewer with special options in order to facilitate
navigation between source and viewer window.

I would like some future version to not hardcode the used viewers, but
rather use the system default (on unixoid systems typically configured
in /etc/mailcap), adding appropriate options for viewers known to
AUCTeX in order to facilitate things like Source Specials.  Now on
systems like Ubuntu, evince is sometimes configured to be the DVI
viewer, yet does not support Source Specials which is quite a
shortcoming.

So this would probably lead to the strategy of using the system
previewer when TeX-source-specials-mode is disabled, but using xdvi
rather than evince (and hoping that it actually exists!) in case
TeX-source-specials-mode is enabled.

Of course, this is a less than satisfactory situation.  Would there be
any chance of evince being able to support source specials in DVI mode
at some point of time?

To make this endeavor more worthwhile, I would be willing to help with
designing equivalent functionality for the PS and PDF formats and do
lobbying work on having them integrated with the Dvips and PDFTeX
programs.  In that manner, evince would gain a killer argument for
preferring it also as PostScript and PDF viewer in connection with
TeX-related work.

Here are the explanations from the xdvi manual page:

SOURCE SPECIALS
	Some  TeX  implementations  or  macro packages  provide  the
	facility   to   automatically   include  so-called   `source
	specials' into  a DVI file.  These contain  the line number,
	eventually  a column number,  and the  filename of  the .tex
	source. This makes  it possible to jump from  a .dvi file to
	the corresponding  place in the  .tex source and  vice versa
	(also called `inverse search' - jumping from the DVI file to
	the TeX file is also  known as `reverse search', and jumping
	from the TeX file to the DVI file as `forward search').

	To be usable with xdvi, source specials in the dvi file must
	have one of the following formats:

		    src:line[ ]filename
		    src:line:col[ ]filename
		    src:line
		    src:line:col
		    src::col

	If filename or line are  omitted, the most recent values are
	used.  The first source special  on each page must be in one
	of  the first two  forms, since  defaults are  not inherited
	across pages.

	You  will  need  a   TeX  implementation  that  provides  an
	appropriate switch (e.g.  -src)  or a macro package (such as
	srcltx.sty      or      srctex.sty,      available      from
	CTAN:macros/latex/contrib/supported/srcltx/)  to insert such
	source specials into the DVI file.

	For reverse  search, the combination Ctrl-Mouse  1 will make
	xdvi open an  editor (the value of the  -editor command line
	option)  with the  file  and  the line  number  of the  .tex
	source. See  the description of the -editor  option for more
	information and example settings.

	For forward  search, xdvi has a  -sourceposition option that
	makes xdvi jump to the page in the DVI file corresponding to
	the given line (or the closest line having a source special)
	of the  specified file and  highlight the found  region. See
	the  description  of  the  -sourceposition option  for  more
	details.

	More information on setting  up various editors for use with
	source specials can be found at:

		http://xdvi.sourceforge.net/inverse-search.html


[...]

Here is the explanation of the respective command line option:

	-sourceposition line[:col][ ]filename
		This option makes  xdvi search in the dvi  file for the
		place  corresponding   to  the  indicated   line  (and,
		optionally,  column)  in  the  .tex  source  file,  and
		highlight the place found by drawing a rectangle in the
		highlight  color  (see   the  -hl  option)  around  the
		corresponding  text.  In addition,  when run  with this
		argument (and  the -nofork  option is not  given, which
		see), xdvi will always return immediately:  if it finds
		another instance of xdvi already showing dvi_file, then
		it  will cause that  instance to  raise its  window and
		move to the  given place in the dvi  file; otherwise it
		will start  up its own instance in  the background.  If
		several instances of xdvi are displaying the respective
		dvi  file, the instance  which was  last raised  to the
		foreground will be used.

		The  space  before  filename  is  only  needed  if  the
		filename starts with a  digit.  When the space is used,
		the argument  needs to be encosed in  quotes to prevent
		the  shell from misinterpreting  the space  as argument
		separator.

		This  option requires  that dvi_file  be  prepared with
		source special information.   See the section on SOURCE
		SPECIALS for details on how to do this.

		Here is a more detailed description of how the filename
		in  the -sourceposition  argument is  matched  with the
		filename in the source specials:

		  1. If neither  of the filenames contains  a path name
			component, the filenames are compared ignoring the
			`.tex' extensions in both filenames.

		  2. Otherwise, if one of  the filenames does contain a
			path  component  (e.g.:  ./test.tex,  ../test.tex,
			/my/homedir/tex/test.tex  or  any  combination  of
			these),  both  filenames are  expanded  to a  full
			path, with any occurences  of ../ and ./ expanded,
			and multiple slashes removed.
			The  pathname in  the -sourceposition  is expanded
			relative to  the current working  directory of the
			xdvi -sourceposition invocation, and the pathnames
			in  the source specials  are expanded  relative to
			the path of the current DVI file being viewed.
			The  path  names are  then  compared ignoring  the
			`.tex' extensions in both path names.


-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]