From c3a452fcf704fd23266de535f77e7b1c0498cc9c Mon Sep 17 00:00:00 2001 From: Stefan Kebekus Date: Sat, 15 Sep 2001 16:21:52 +0000 Subject: [PATCH] started to update the documentation svn path=/trunk/kdegraphics/doc/kdvi/; revision=114371 --- doc/index.docbook | 1000 +++++++++++++++++++++++++++++---------------- doc/srcltx.sty | 184 +++++++++ doc/srctex.sty | 146 +++++++ 3 files changed, 970 insertions(+), 360 deletions(-) create mode 100644 doc/srcltx.sty create mode 100644 doc/srctex.sty diff --git a/doc/index.docbook b/doc/index.docbook index 116257628..2b48d39ea 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -1,379 +1,659 @@ - - - + + + ]> - - - - The &kdvi; Manual - - - -Markku -Hihnala -
mah@ee.oulu.fi
-
- - -Stefan -Kebekus -
kebekus@kde.org
-
- - -
- -2001-06-05 -0.09.02 - -&underFDL; - - -2000 -Markku Hihnala -Stefan Kebekus - - - -This Handbook describes &kdvi; Version 0.9 - - - -KDE -DVI -TeX -LaTeX -device-independent -viewer -dvi viewer -kdvi -xdvi - -
- - -Introduction - - -&kdvi; is a plugin for the &kviewshell; program which allows -&kviewshell; to display &DVI;-files which are produced by the TeX -typesetting system. - - - -More information about TeX and &DVI; can be found on the homepage of the -TeX user group. &kdvi; supports the inclusion of &PostScript; graphics -and it supports hyperlinks. More details and the technical -specifications can be found in the file -KDVI-features.dvi. - - - -For up-to-date information, consult kdvi's home page. - - - - - -Starting &kdvi; - - -For convenience there exists a command kdvi which -calls &kviewshell; with the &kdvi; plugin preloaded. The viewer may thus -be started using the command kdvi -somepath/paper.dvi, or without a file -name as &kviewshell; will then allow a file to be opened from a dialog -or a menu of recently used files. - - - -The usual parameters handled by &Qt; and &kde; applications also -work: kdvi -windows -:0 -400x400+0+0 -"DVI" - - - -For integration with TeX the opened &DVI; file is automatically reloaded -when changed. - - - - - -The <guilabel>Preferences</guilabel> dialog - - -The Preferences dialog can be reached by choosing -Settings DVI -options inside &kviewshell;. - - - -The dialog consists of two tabs, Fonts and -Rendering. - - - -<guilabel>Fonts</guilabel> Options - - -The following picture shows the options dialog of -&kdvi;. - - - -The Fonts dialog - - - - -The Fonts dialog - - - - - - -Metafont mode - - -These options specify the fonts which &kdvi; will use for rendering. By -carefully optimizing the settings here it is possible to improve on the -display. However, unless you are an expert in -MetaFont and know what you are doing, it is not a -good idea to change these options. - - -Safe values are 1200 dpi / Lexmark for good -quality, or 600 dpi / LaserJet 4 for medium quality -and faster display. - - - - - -Generate missing fonts - - -Check this if you want &kdvi; to call the MetaFont -program in the likely case that kdvi wants to display documents which -use fonts which are not yet readily made. You most certainly want to set -this option. - - - - - - - - -<guilabel>Rendering</guilabel> Options - - - -The following picture shows the second options dialog of &kdvi;. - - - -The Rendering dialog - - - - -The Rendering dialog - - - - - - -Show PostScript specials - - -If this options is checked, &kdvi; will display -&PostScript; graphics which are embedded into the &DVI; -file. + + The &kdvi; Handbook + + + Stefan + Kebekus + +
+ kebekus@kde.org +
+
+
+ +
+ + + 2001 + Stefan Kebekus + + + &FDLNotice; + + 2001-01-09 + 1.0 + + + This document describes &kdvi; version 1.0 + + + + KDE + linux + TeX + DVI + + +
+ + + Introduction + + &kdvi; is a plugin for the &kviewshell; program which allows + &kviewshell; to display &DVI;-files (.dvi) which are produced by the TeX + typesetting system. &kdvi; supports many extensions of the DVI + standard, for instance the inclusion of &PostScript; graphics or + hyperlinks. More details, examples and all the technical + specifications can be found in the file KDVI-features.dvi + (click here for the + TeX-source of that file). + + For up-to-date information, consult kdvi's home page. + + + TeX is a high-end typesetting system geared towards + scientific, and in particular mathematical typesetting. More + information about TeX and &DVI; can be found on the homepage of the TeX user group or + the German German DANTE + e.V.. + + + + + + Starting &kdvi; + + Most of the time, &kdvi; will be started by just clicking + onto a .dvi-file in the file + manager. For convenience there exists a command + kdvi which calls &kviewshell; with the &kdvi; + plugin preloaded. The viewer may thus be started using the command + kdvi + somepath/paper.dvi. The command + lines kdvi + somepath/paper or + kdvi + somepath/paper. will also work. + + + The usual parameters handled by &Qt; and &kde; applications + also work: kdvi + windows + :0 + 400x400+0+0 + "DVI" + + + + + + Printing DVI-Files + + &kdvi; can print your DVI-files using the standard KDE + printing interface. Internally, &kdvi; uses the programm + dvips to generate PostScript, which is then + passed on to the printer. In particular, dvips + must be installed if you want to print with &kdvi;. The programm + dvips uses its own configuration files and its + own settings, which are fine for most purposes. However, if you + care for optimal printing results, you should configure + dvips manually and make sure to set a default + MetaFont mode which fits your printer best ---on many systems + you'll find a GNU-texinfo documentation + of dvips, and you might also want to + look for a file called dvips.dvi or + similar. + + + + Exporting the DVI file to other formats + + If you want to save your file as in PostScript or + PDF-format, it is not recommended that you use the printing + function and redirect the printer output to a file. Instead, you + can use the export functions which produce better-quality output + that retains many of the special features of the dvi format and + looks better in many of the viewing applications, such as Adobe's + Acrobat Reader. You will find the export functions in the + File menu. + +
+ Exporting to PostScript + + As in printing, the external program + dvips is used to generate the PostScript + file. If the DVI-file contains hyperlinks, these will also be + included in the PostScript file. If you are an export, and if + you would like to generate output which is optimized for a + specific printer, you should probably start + dvips manually and choose the proper MetaFont + mode yourself. +
+ +
+ Exporting to PDF + + In order to produce PDF files of high quality, &kdvi; + converts DVI to PDF using the external program + dvipdfm. If you are working on a machine + where an older distribution of the TeX typesetting system is + installed, it may be that the programm + dvipdfm is not installed. In that case, you + need to use the printing function to generate PDF + output. + + If you are viewing the generated file in Adobe's + Acrobat reader, you may well find that some of the fonts look + extremely poor although a printout is fine, and although the + document looks ok in ghostview. This is a known issue with the + Acrobat Reader and bitmap fonts. At the time of writing, the + only practicable workaround seems to be to avoid bitmap + fonts. + +
+
+ + + + Using inverse search + + Inverse search is a very useful feature when you are writing + a TeX-text yourself. If everything is properly set up, you can + click into KDVI's window with the right mouse button. After that, + your favourite editor will open, load the TeX-sourcefile and jump + to the proper paragraph. To use inverse search, do the following: + + + + Let &kdvi; know which editor you would like to + use. Choose an editor in the Preferences + dialog which can be reached by choosing + Settings in the menu DVI + options. The next chapter, "The preferences dialog/Rendering + Options", explains this dialog in more detail. + + + Some editors need to be started manually, or need + additional configuration. You will find a description of all + supported editors in the, "Setting up your + editor" below. + + + + +
+ Producing TeX-files for inverse search + There are essentially two ways to produce DVI-files which + contain inverse search information: you can either use a + TeX/LaTeX-binary which generates and includes the necessary + information automatically, or you can include an extra package + which is written in TeX/LaTeX. + + + A TeX binary which generates and includes the + necessary information automatically, is certainly the + preferred method of including inverse search information. By + the time of writing, a binary was not yet available for + Unix. However, it is said that the next version of the + TeTeX + TeX-distribution will support inverse search + natively. + + + + If you do not have a TeX-binary which includes inverse + search information natively, copy the files srcltx.sty and + srctex.sty to + the directory where your TeX-file resides (you can do that + by shift-clicking the hyperlinks). If you use LaTeX, add the + line + + + + \usepackage[active]{srcltx} + + + to the preamble of your TeX-file. If you use plain TeX, the line + + + + \include{srctex} + + + will do the trick. + + + + + While inverse search is extremely useful when you are + typing a document yourself, it might be a good idea to remove + the inverse search information before sending the DVI file to + someone else. + + +
+ +
+ + Setting up your editor + + While inverse search works generally very well with most + editors, some of them require a bit of extra care. This section + explains how to configure your editor. + +
+ Kate + + Unfortunately, KDE's editor kate does not support the + inverse search very well. A middle-button mouseclick into the + DVI file will always open a new instance of the kate editor, + even if kate is already running and even if the TeX-file is + already loaded. Worse, kate does not move the cursor to the + beginning of the paragraph. +
+ +
+ NEdit + + NEdit generally works very well indeed. Clicking into the + DVI file should open a new window. If the TeX-file is already + used in another window of NEdit, the newly opened window + displays another view of the buffer. Otherwise, the TeX-file is + loaded. After opening the window, NEdit highlights the first + line of the appropriate paragraph. + + + + Make sure that NEdit is installed. Try to start + nedit from the command line. + + + &kdvi; uses the command ncl to + remote control NEdit. Make sure that ncl + is available on the command line by trying the command + ncl + -noask. This which should + open an instance of the NEdit editor. If + ncl is not available, you might be using + an older version of NEdit. In that case, you should either + upgrade to a more recent version, or you have to use the + option "User defined editor" from the Options dialog. + + + +
+ +
+ XEmacs + + XEmacs works well with &kdvi;. The actual behaviour of + XEmacs depends largely on the configuration. As usual, you can + customize XEmacs complete, if you are willing to fight your way + through Lisp code. + + &kdvi; uses the program gnuclient to + remote control XEmacs. + + The program gnuclient requires that + XEmacs is running, and that the program gnuserv is started + inside XEmacs. Inverse search will not work unless you have + started both XEmacs and gnuserv. + + + To start the gnuserv program, you can do one of the following: + + + In XEmacs, start gnuserv by typing M-x + gnuserv-start + + + Add the line + + (gnuserv-start) + + to your .emacs or + .xemacs file. + + + + If you don't want to open a new frame for each editor + call, and want the frame to be auto-raised, set "Gnuserv Frame" + to "Use selected frame", and add the "raise-frame" function to + "Visit Hook". Do M-x customize-group RET + gnuserv to make these settings. The resulting + entries in your .emacs file should look + like this: + + (custom-set-variables + ;;; ... other stuff ... + '(gnuserv-frame t) + '(gnuserv-visit-hook (lambda () (raise-frame) (recenter)))) + - -If an external &PostScript; file could not be found, &kdvi; will draw a -red warning box in its place. Unfortunately, rendering &PostScript; -graphics is very slow in the current version of &kdvi;. We will improve -on the speed in later versions. If this option is off, &kdvi; will -either draw a grey box as a placeholder for the graphics, or it will -leave the space blank. - - - - -There is no standard way to embed &PostScript; graphics into a dvi -file. It may therefore happen that &kdvi; cannot properly display a -graphic which works fine with other programs. Older versions of -xdvi and dvips support the -execution of external commands. This is a hight security risk and -therefore deliberately not implemented in &kdvi;. Technical information -about supported ways to include &PostScript; can be found in an external -document. You probably want to set this option. - + + + + Make sure that XEmacs is installed. Try to start + xemacs from the command line. + + + &kdvi; uses the command gnuserv to + remote control XEmacs. Make sure that + gnuclient is available on the command + line by trying the command + gnuclient 'Name of + a text file'. This should open a new + frame in the XEmacs editor. + + If gnuserv fails with an + error message like unable to connect to + local, make sure that XEmacs is + running. Furthermore, make sure that gnuserv is started by + typing M-x gnuserv-start. + + + +
+ +
+ VI iMproved / GUI + + &kdvi; supports vim, but the result is not thrilling. A + middle-button mouseclick into the DVI file will always open a + new instance of the vim editor, even if vim is already running + and even if the TeX-file is already loaded. + + + + Make sure that VIM/GUI is installed. Try to start + gvim from the command line. + + + +
+
+ +
+ + + + The <guilabel>Preferences</guilabel> dialog + + The Preferences dialog can be reached + by choosing Settings + DVI options inside + &kviewshell;. + + The dialog consists of two tabs, Fonts + and Rendering. + + + <guilabel>Fonts</guilabel> Options + + The following picture shows the options dialog of + &kdvi;. + + + The Fonts dialog + + + + + + The Fonts dialog + + + + + + + Metafont mode + + These options specify the fonts which &kdvi; will + use for rendering. By carefully optimizing the settings + here it is possible to improve on the display. However, + unless you are an expert in MetaFont + and know what you are doing, it is not a good idea to + change these options. + + Safe values are 1200 dpi / + Lexmark for good quality, or 600 dpi + / LaserJet 4 for medium quality and faster + display. + + + + + Generate missing fonts + + Check this if you want &kdvi; to call the + MetaFont program in the likely case + that kdvi wants to display documents which use fonts which + are not yet readily made. You most certainly want to set + this option. + + + + + + + <guilabel>Rendering</guilabel> Options + + The following picture shows the second options dialog of + &kdvi;. + + + The Rendering dialog + + + + + The Rendering dialog + + + + + + + Show PostScript specials + + If this options is checked, &kdvi; will display + &PostScript; graphics which are embedded into the &DVI; + file. + + If an external &PostScript; file could not be found, + &kdvi; will draw a red warning box in its + place. Unfortunately, rendering &PostScript; graphics is + very slow in the current version of &kdvi;. We will + improve on the speed in later versions. If this option is + off, &kdvi; will either draw a grey box as a placeholder + for the graphics, or it will leave the space blank. + + + There is no standard way to embed &PostScript; + graphics into a dvi file. It may therefore happen that + &kdvi; cannot properly display a graphic which works + fine with other programs. Older versions of + xdvi and dvips + support the execution of external commands. This is a + high security risk and therefore deliberately not + implemented in &kdvi;. Technical information about + supported ways to include &PostScript; can be found in + an external document. You probably want to set this + option. - - - -Hyperlinks - - -Check this if you want &kdvi; to display hyperlinks. The appropriate -parts of the text will be underlined in blue. You probably want to set -this option. - - - - - - - - - -Printing - - -This version has a print setup dialog (available from the print dialog) -that lets you configure the printing method, n-up program, printer names -and spooler command. Printing method selects the external program to use -for printing. Available choices are dvips and -dvilj4. If you use dvips, you can -also have an n-up program called to make 2 or 4 pages per sheet. Select -psnup (preferred) or mpage (may -work) if you have that installed in your system. - - - -You may add printer names that will be available in the print dialog. - - - -And last you can change the spooler command (defaults to -lpr) that is supposed to read standard input. Option - is appended when printing to nondefault printer. - - - -Having setup printing you can use the print dialog where you can select -the pages to be printed, which printer or file to use for output and -more. - - - - -Q & A - - - - - -Why is &kdvi; not displaying anything but a busy cursor? - - - - -It is possible, that &kdvi; is searching for the pk-fonts from wrong -places, and this can be very time consuming if these include network -mounted filesystems. You can check for this with -strace and see below for a cure. - - - - - - - -What can I do when &kdvi; does not find my PK-fonts? - - - - -You must have correct settings for resolution and -Metafont mode. If this does not help, you may set the -field 'PK Font Path' in Preferences/Fonts to point to the list of -directories to be searched for pk-fonts: /var/lib/texmf/fonts/pk/ljfour/:/some/other/place. -You can make &kdvi; search recursively by adding an extra / at the end -of directory name: /var/lib/texmf/fonts// (This -works like xdvi's XDVIFONTS -environment variable. There is also good (gnu info) -documentation available for the kpathsea library that &kdvi; uses for -font searching.) This makes &kdvi; usable when you have some other tex -system than tetex and don't have the -texmf.cnf file. - - - - - - - -How do I get the font generation to work? - - - - -If you would like to enable automatic font generation using -MakeTeXPK, you must also supply correct -Metafont mode in preferences dialog. When automatic -pk-font generation is disabled (menu option) the missing fonts will be -logged to file missfont.log in the current -directory. It is a good idea to check that the font generation commands -in missfont.log are correct before enabling font -generation - - - - - - - - -Credits and Licenses - -&kdvi; - - -&kdvi; 0.9 is based on based on the stand-alone-program &kdvi; 0.4.3 by -Markku Hihnala. That program is in turn based on -xdvi version 18f which has many authors. - - - -Documentation is copyright 2000, 2001, Markku Hihnala -mah@ee.oulu.fi and Stefan Kebekus -kebekus@kde.org - - - - +
+ + + Hyperlinks + + Check this if you want &kdvi; to display + hyperlinks. The appropriate parts of the text will be + underlined in blue. You probably want to set this + option. + + +
+ +
+
+ + + + Q & A + + + + + What happens when &kdvi; displays the message + "Generating bitmap fonts", and why does the procedure take + so long? + + + The TeX typesetting system is geared towards highest + quality output, and the same holds for the fonts which are + used by TeX. + + + + + + What can I do when &kdvi; does not find my + PK-fonts? + + + You must have correct settings for resolution and + Metafont mode. If this does not help, you + may set the field 'PK Font Path' in Preferences/Fonts to + point to the list of directories to be searched for + pk-fonts: /var/lib/texmf/fonts/pk/ljfour/:/some/other/place. + You can make &kdvi; search recursively by adding an extra / + at the end of directory name: + /var/lib/texmf/fonts// (This works + like xdvi's XDVIFONTS + environment variable. There is also good (gnu + info) documentation available for the + kpathsea library that &kdvi; uses for font searching.) This + makes &kdvi; usable when you have some other tex system than + tetex and don't have the + texmf.cnf file. + + + + + + How do I get the font generation to work? + + + If you would like to enable automatic font generation + using MakeTeXPK, you must also supply + correct Metafont mode in preferences + dialog. When automatic pk-font generation is disabled (menu + option) the missing fonts will be logged to file + missfont.log in the current directory. + It is a good idea to check that the font generation commands + in missfont.log are correct before + enabling font generation + + + + + + + + Credits and Licenses + + &kdvi; + + &kdvi; is based on based on the stand-alone-program &kdvi; + 0.4.3 by Markku Hihnala. That program is in turn based on + xdvi version 18f which has many + authors. + + Documentation is copyright 2000, 2001, Markku Hihnala + mah@ee.oulu.fi and Stefan Kebekus + kebekus@kde.org + + + &underGPL; &underFDL; - - - -Installation + + + + + Installation + + &kghostview; is part of the &kde; 2 project, details of + which can be found at + http://www.kde.org. + + To use &kghostview;, you must have the + Ghostscript program as well as &kde; 2 + installed on your machine. The + Ghostscript home page is at + +http://www.cs.wisc.edu/~ghost/ + + Most distributions will include &kghostview;, but if you + want to roll your own the source code can be found in the + Kdegraphics package on ftp://ftp.kde.org/pub/kde/, + the main ftp site of the KDE project. + + To see if a later version of &kghostview; has been released, + you can take a look in http://apps.kde.com. + + To compile and install &kghostview; on your system, as root + type the following in the directory where you saved the + &kghostview; source code: + + +% ./configure +% make +% make + -&kdvi; is part of the kdegraphics module of &kde;. +Since &kghostview; uses autoconf and +automake you should not have any trouble compiling +it. But if you do run into problems please report them to the &kde; +mailing lists. +&documentation.index; +
+ diff --git a/doc/srcltx.sty b/doc/srcltx.sty new file mode 100644 index 000000000..3e2d61a31 --- /dev/null +++ b/doc/srcltx.sty @@ -0,0 +1,184 @@ + +% ------------------------------------------------------------------------ +% File: srcltx.sty +% ========== +% +% Version 1.002 1999 Sep 3 (modified to change \everypar) +% by David Carlisle +% +% Version 1.001 1998 Dec 23 (modified to change \output) +% by Berthold Horn +% +% This package was originally written by Aleksander Simonic (the +% author of WinEdt Shell) to implement a source file tracking and +% DVI "SRC" specials for LaTeX. +% +% This package comes with no guarantees and no reserved rights. +% You can use or modify this file at your own risk. +% ************************************************************************ +% NOTE: TeX commands are case sensitive. You have to use uppercase +% \Input to take advantage of this package +% +% This package supports nested \Input commands... +% File extension should be specified in \Input! +% +% This file should be placed in a directory where your LaTeX is +% looking for inputs (eg. ...\localtexmf\tex for MiKTeX). +% +% If you are writing a book with WinEdt and LaTeX simply +% include this file and use \include{mychapter} command... +% This way all the necessary specials for DVI Search and +% Inverse Search are inserted in your DVI File. +% +% WinEdt will be able to track Errors from your LOG file. +% +% ************************************************************************ +% +% Some TeX implementations (eg. MiKTeX 1.20 [or later]) can insert +% the SRC specials much better than any macro package. Consult your +% TeX documentation to see if it is better to leave the task to your +% TeX. You can still use the [inactive] version of this package to +% take advantage of the re-defined Input commands and thus allowing +% WinEdt to keep track of errors in included source files. +% +% MiKTeX inserts the SRC specials in the DVI file if you start +% [La]TeX with --src qualifier (see MiKTeX's Manual: +% ...\texmf\Doc\MiKTeX\MiKTeX.pdf for more info). +% +% ************************************************************************ +% +% * NOTE: Some TeX implementations add the file type to the "\jobname". +% In that case the definition of the "\MainFile" should be modified to: +% +% \def\MainFile{\jobname} instead of \def\MainFile{\jobname.tex}. +% +% ************************************************************************ +% +% *** Example - Your LaTeX thesis document may look like this: +% +%\documentclass[12pt]{report} +%\usepackage[centertags]{amstex} +%\usepackage{thesis,newlfont,amsthm} +%\usepackage[active]{srcltx} +%%No src specials are written when loading the package by +%%\usepackage[inactive]{srcltx} +% +% .... Preamble .... +% +%\begin{document} +% +% .... Title, Author etc. .... +% +%\WinEdt{?0000} % Do not process any Errors (Overful/Underful Boxes) +%\beforepreface +%\WinEdt{?1111} % Process All Types of Errors from here on +%\include{ABS} +%\include{ACK} +%\afterpreface +%\include{chapter0} +%\include{chapter1} +%\include{chapter2} +%\include{chapter3} +%\bibliographystyle{amsplain} +%\bibliography{xbib} +%\end{document} +% +% ------------------------------------------------------------------------ +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{srcltx}[1999/10/11 v1.002 DVI Search] +\newif\ifSRCOK \SRCOKtrue +\DeclareOption{active}{\SRCOKtrue} +\DeclareOption{inactive}{\SRCOKfalse} +\ExecuteOptions{inactive} +\ProcessOptions +% ------------------------------------------------------------------------ +\newcount\PAGETOP +\newcount\LASTLINE +\global\PAGETOP=1 +\global\LASTLINE=-1 +\gdef\MainFile{\jobname.tex}% ".tex" needed for MiKTeX +\gdef\CurrentInput{\MainFile} +\newcount\INPSP +\global\INPSP=0 +\def\EJECT{\SRC\eject} +\def\WinEdt#1{\typeout{:#1}}% WinEdt LOG MODE and INPUT +% ------------------------------------------------------------------------ +%If your are using DVIWIN remove the \space from the definitions below... +\def\SRC{\ifSRCOK% + \ifnum\inputlineno>\LASTLINE% + \ifnum\LASTLINE<0% + \global\PAGETOP=\inputlineno% + \fi% + \global\LASTLINE=\inputlineno% + \ifnum\INPSP=0% + \ifnum\inputlineno>\PAGETOP% + \special{src:\the\inputlineno\space\CurrentInput}% + \fi% + \else% + \special{src:\the\inputlineno\space\CurrentInput}% + \fi% + \fi% +\fi} +% ------------------------------------------------------------------------ +\def\PUSH#1{% +\SRC% +\ifnum\INPSP=0 \global\let\INPSTACKA=\CurrentInput \else% +\ifnum\INPSP=1 \global\let\INPSTACKB=\CurrentInput \else% +\ifnum\INPSP=2 \global\let\INPSTACKC=\CurrentInput \else% +\ifnum\INPSP=3 \global\let\INPSTACKD=\CurrentInput \else% +\ifnum\INPSP=4 \global\let\INPSTACKE=\CurrentInput \else% +\ifnum\INPSP=5 \global\let\INPSTACKF=\CurrentInput \else% + \global\let\INPSTACKX=\CurrentInput \fi\fi\fi\fi\fi\fi% +\gdef\CurrentInput{#1}% +\WinEdt{<+ \CurrentInput}% +\global\LASTLINE=0% +\ifSRCOK\special{src:1\CurrentInput}\fi% +\global\advance\INPSP by 1} +% +\def\POP{% +\ifnum\INPSP>0 \global\advance\INPSP by -1 \fi% +\ifnum\INPSP=0 \global\let\CurrentInput=\INPSTACKA \else% +\ifnum\INPSP=1 \global\let\CurrentInput=\INPSTACKB \else% +\ifnum\INPSP=2 \global\let\CurrentInput=\INPSTACKC \else% +\ifnum\INPSP=3 \global\let\CurrentInput=\INPSTACKD \else% +\ifnum\INPSP=4 \global\let\CurrentInput=\INPSTACKE \else% +\ifnum\INPSP=5 \global\let\CurrentInput=\INPSTACKF \else% + \global\let\CurrentInput=\INPSTACKX \fi\fi\fi\fi\fi\fi% +\WinEdt{<-}% +\global\LASTLINE=\inputlineno% +\global\advance\LASTLINE by -1% +\SRC} +% ------------------------------------------------------------------------ +% Dummy Input: can be used as \INPUT{.bbl} to collect \bibitems +\def\INPUT#1{\relax} +% ------------------------------------------------------------------------ +% Redefine the original \include command +\let\OldINCLUDE=\include +\def\include#1{%Always ".tex" file type! +\EJECT% +\PUSH{#1.tex}% +\OldINCLUDE{#1}% +\POP} +% ------------------------------------------------------------------------ +\def\Input#1{%Specify File Extension! +\PUSH{#1}% +\input #1% +\POP} +% ------------------------------------------------------------------------ +% Note that these have been defined to concatenate the \SRC with +% whatever those token lists did before, just in case they were not +% empty token lists. Of course, later definitions may undo all this... +\let\originalxxxeverypar\everypar +\newtoks\everypar +\originalxxxeverypar{\the\everypar\expandafter\SRC} +%\everypar\expandafter{\the\everypar\expandafter\SRC} +% ??? Remove the following line if you encounter problems: +\everymath\expandafter{\the\everymath\expandafter\SRC} +% ------------------------------------------------------------------------ +% Redefine the \bibliography command: +\let\zzzxxxbibliography=\bibliography +\def\bibliography#1{\PUSH{\jobname.bbl}\zzzxxxbibliography{#1}\POP} +%------------------------------------------------------------------------ +% Modification to output routine to turn off \SRC while \output is active +\output\expandafter{\expandafter\SRCOKfalse\the\output} +%------------------------------------------------------------------------ diff --git a/doc/srctex.sty b/doc/srctex.sty new file mode 100644 index 000000000..26ecd74be --- /dev/null +++ b/doc/srctex.sty @@ -0,0 +1,146 @@ +% ------------------------------------------------------------------------ +% File: srctex.sty +% ========== +% +% Version 1.002 1999 Sep 3 (modified to change \everypar) +% by David Carlisle +% +% Version 1.001 1998 Dec 23 (modified to change \output) +% by Berthold Horn +% +% This package was originally written by Aleksander Simonic (the +% author of WinEdt Shell) to implement a source file tracking and +% DVI "SRC" specials for TeX. +% +% This package comes with no guarantees and no reserved rights. +% You can use or modify this file at your own risk. +% ************************************************************************ +% NOTE: TeX commands are case sensitive. You have to use uppercase +% \Input to take advantage of this package +% +% This package supports nested \Input commands... +% File extension should be specified in \Input! +% +% This file should be placed in a directory where your TeX is +% looking for inputs (eg. ...\localtexmf\tex for MiKTeX). +% +% ************************************************************************ +% +% Some TeX implementations (eg. MiKTeX 1.20 [or later]) can insert +% the SRC specials much better than any macro package. Consult your +% TeX documentation to see if it is better to leave the task to your +% TeX. You can still use the [inactive] version of this package to +% take advantage of the re-defined Input commands and thus allowing +% WinEdt to keep track of errors in included source files. +% +% MiKTeX inserts the SRC specials in the DVI file if you start +% TeX with --src qualifier (see MiKTeX's Manual: +% ...\texmf\Doc\MiKTeX\MiKTeX.pdf for more info). +% +% ************************************************************************ +% +% If you are writing a book with WinEdt Shell and TeX simply +% include this file and use "\Input{my_chapter}" instead of +% "\input my_chapter". This way all the necessary specials for +% DVI Search and Inverse Search are inserted in your DVI File. +% +% WinEdt will be able to track Errors from your LOG file. +% +% To remove SRC Specials from the dvi file compile the source +% after inserting \SRCOKfalse immediately after +% the \usepackage{srctex} directive... +% +% This package supports nested \Input commands... +% File extension should be specified in \Input! +% +% ************************************************************************ +% +% * NOTE: Some TeX implementations add the file type to the "\jobname". +% In that case the definition of the "\MainFile" should be modified to: +% +% \def\MainFile{\jobname} instead of \def\MainFile{\jobname.tex}. +% +% ************************************************************************ +\def\typeout#1{\message{^^J}\message{#1}\message{^^J}} +% +\newif\ifSRCOK \SRCOKtrue +\newcount\PAGETOP +\newcount\LASTLINE +\global\PAGETOP=1 +\global\LASTLINE=-1 +\def\EJECT{\SRC\eject} +\def\WinEdt#1{\typeout{:#1}}% WinEdt LOG MODE and INPUT +\gdef\MainFile{\jobname.tex}% ".tex" needed for MiKTeX +\gdef\CurrentInput{\MainFile} +\newcount\INPSP +\global\INPSP=0 +% ------------------------------------------------------------------------ +%If your are using DVIWIN remove the \space from the definitions below... +\def\SRC{\ifSRCOK% + \ifnum\inputlineno>\LASTLINE% + \ifnum\LASTLINE<0% + \global\PAGETOP=\inputlineno% + \fi% + \global\LASTLINE=\inputlineno% + \ifnum\INPSP=0% + \ifnum\inputlineno>\PAGETOP% + \special{src:\the\inputlineno\space\CurrentInput} + \fi% + \else% + \special{src:\the\inputlineno\space\CurrentInput} + \fi% + \fi% +\fi} +% ------------------------------------------------------------------------ +\def\PUSH#1{% +\SRC% +\ifnum\INPSP=0 \global\let\INPSTACKA=\CurrentInput \else% +\ifnum\INPSP=1 \global\let\INPSTACKB=\CurrentInput \else% +\ifnum\INPSP=2 \global\let\INPSTACKC=\CurrentInput \else% +\ifnum\INPSP=3 \global\let\INPSTACKD=\CurrentInput \else% +\ifnum\INPSP=4 \global\let\INPSTACKE=\CurrentInput \else% +\ifnum\INPSP=5 \global\let\INPSTACKF=\CurrentInput \else% + \global\let\INPSTACKX=\CurrentInput \fi\fi\fi\fi\fi\fi% +\gdef\CurrentInput{#1}% +\WinEdt{<+ \CurrentInput}% +\global\LASTLINE=0% +\ifSRCOK\special{src:1\CurrentInput}\fi% +\global\advance\INPSP by 1} +% +\def\POP{% +\ifnum\INPSP>0 \global\advance\INPSP by -1 \fi% +\ifnum\INPSP=0 \global\let\CurrentInput=\INPSTACKA \else% +\ifnum\INPSP=1 \global\let\CurrentInput=\INPSTACKB \else% +\ifnum\INPSP=2 \global\let\CurrentInput=\INPSTACKC \else% +\ifnum\INPSP=3 \global\let\CurrentInput=\INPSTACKD \else% +\ifnum\INPSP=4 \global\let\CurrentInput=\INPSTACKE \else% +\ifnum\INPSP=5 \global\let\CurrentInput=\INPSTACKF \else% + \global\let\CurrentInput=\INPSTACKX \fi\fi\fi\fi\fi\fi% +\WinEdt{<-}% +\global\LASTLINE=\inputlineno% +\global\advance\LASTLINE by -1% +\SRC} +% ------------------------------------------------------------------------ +% Dummy Input: can be used as \INPUT{.bbl} to collect \bibitems +\def\INPUT#1{\relax} +% ------------------------------------------------------------------------ +\def\Input#1{%Specify File Extension! +\SRC% +\PUSH{#1}% +\input #1% +\POP% +\SRC} +% ------------------------------------------------------------------------ +% Note that these have been defined to concatenate the \SRC with +% whatever those token lists did before, just in case they were not +% empty token lists. Of course, later definitions may undo all this... +\let\originalxxxeverypar\everypar +\newtoks\everypar +\originalxxxeverypar{\the\everypar\expandafter\SRC} +%\everypar\expandafter{\the\everypar\expandafter\SRC} +% ??? Remove the following line if you encounter problems: +\everymath\expandafter{\the\everymath\expandafter\SRC} +%------------------------------------------------------------------------ +% Modification to output routine to turn off \SRC while \output is active +\output\expandafter{\expandafter\SRCOKfalse\the\output} +%------------------------------------------------------------------------