auctex: Starting Viewers

 
 4.2.1 Starting Viewers
 ----------------------
 
 Viewers are normally invoked by pressing 'C-c C-c' once the document is
 formatted, which will propose the View command, or by activating the
 respective entry in the Command menu.  Alternatively you can type 'C-c
 C-v' which calls the function 'TeX-view'.
 
  -- Command: TeX-view
      ('C-c C-v') Start a viewer without confirmation.  The viewer is
      started either on a region or the master file, depending on the
      last command issued.  This is especially useful for jumping to the
      location corresponding to point in the viewer when using
      'TeX-source-correlate-mode'.
 
    AUCTeX will try to guess which type of viewer (DVI, PostScript or
 PDF) has to be used and what options are to be passed over to it.  This
 decision is based on the output files present in the working directory
 as well as the class and style options used in the document.  For
 example, if there is a DVI file in your working directory, a DVI viewer
 will be invoked.  In case of a PDF file it will be a PDF viewer.  If you
 specified a special paper format like 'a5paper' or use the 'landscape'
 option, this will be passed to the viewer by the appropriate options.
 Especially some DVI viewers depend on this kind of information in order
 to display your document correctly.  In case you are using 'pstricks' or
 'psfrag' in your document, a DVI viewer cannot display the contents
 correctly and a PostScript viewer will be invoked instead.
 
    The association between the tests for the conditions mentioned above
 and the viewers is made in the variable 'TeX-view-program-selection'.
 Therefore this variable is the starting point for customization if you
 want to use other viewers than the ones suggested by default.
 
  -- User Option: TeX-view-program-selection
      This is a list of predicates and viewers which is evaluated from
      front to back in order to find out which viewer to call under the
      given conditions.  In the first element of each list item you can
      reference one or more predicates defined in
      'TeX-view-predicate-list' or 'TeX-view-predicate-list-builtin'.  In
      the second element you can reference a viewer defined in
      'TeX-view-program-list' or 'TeX-view-program-list-builtin'.  The
      viewer of the first item with a positively evaluated predicate is
      selected.
 
    So 'TeX-view-program-selection' only contains references to the
 actual implementations of predicates and viewer commands respectively
 which can be found elsewhere.  AUCTeX comes with a set of preconfigured
 predicates and viewer commands which are stored in the variables
 'TeX-view-predicate-list-builtin' and 'TeX-view-program-list-builtin'
 respectively.  If you are not satisfied with those and want to overwrite
 one of them or add your own definitions, you can do so via the variables
 'TeX-view-predicate-list' and 'TeX-view-program-list'.
 
  -- User Option: TeX-view-predicate-list
      This is a list of predicates for viewer selection and invocation.
      The first element of each list item is a symbol and the second
      element a Lisp form to be evaluated.  The form should return nil if
      the predicate is not fulfilled.
 
      A built-in predicate from 'TeX-view-predicate-list-builtin' can be
      overwritten by defining a new predicate with the same symbol.
 
  -- User Option: TeX-view-program-list
      This is a list of viewer specifications each consisting of a
      symbolic name and either a command line or a function to be invoked
      when the viewer is called.  If a command line is used, parts of it
      can be conditionalized by prefixing them with predicates from
      'TeX-view-predicate-list' or 'TeX-view-predicate-list-builtin'.
      (See the doc string for the exact format to use.)  The command line
      can also contain placeholders as defined in 'TeX-expand-list' and
      'TeX-expand-list-builtin' which are expanded before the viewer is
      called.
 
      The third element of each item is a string, or a list of strings,
      with the name of the executable, or executables, needed to open the
      output file in the viewer.  Placeholders defined in
      'TeX-expand-list' and 'TeX-expand-list-builtin' can be used here.
      This element is optional and is used to check whether the viewer is
      actually available on the system.
 
      A built-in viewer spec from 'TeX-view-program-list-builtin' can be
      overwritten by defining a new viewer spec with the same name.
 
    After the viewer is called via either the View command or the key
 stroke 'C-c C-v', the window system focus goes and stays on the viewer.
 If you prefer that the focus is pulled back to Emacs immediately after
 that and you are using evince-compatible viewer, customize the option
 'TeX-view-enince-keep-focus'.
 
  -- User Option: TeX-view-evince-keep-focus
      When this option is non-nil and the viewer is compatible with
      evince, the focus is pulled back to Emacs immediately after the
      viewer is invoked or refreshed from within AUCTeX.
 
    Note that the viewer selection and invocation as described above will
 only work if certain default settings in AUCTeX are intact.  For one,
 the whole viewer selection machinery will only be triggered if there is
 no '%V' expander in 'TeX-expand-list'.  So if you have trouble with the
 viewer invocation you might check if there is an older customization of
 the variable in place.  In addition, the use of a function in
 'TeX-view-program-list' only works if the View command in
 'TeX-command-list' makes use of the hook 'TeX-run-discard-or-function'.
 
    Note also that the implementation described above replaces an older
 one which was less flexible.  This old implementation works with the
 variables 'TeX-output-view-style' and 'TeX-view-style' which are used to
 associate file types and style options with viewers.  If desired you can
 reactivate it by using the placeholder '%vv' for the View command in
 'TeX-command-list'.  Note however, that it is bound to be removed from
 AUCTeX once the new implementation proved to be satisfactory.  For the
 time being, find a short description of the mentioned customization
 options below.
 
  -- User Option: TeX-output-view-style
      List of output file extensions, style options and view options.
      Each item of the list consists of three elements.  If the first
      element (a regular expression) matches the output file extension,
      and the second element (a regular expression) matches the name of
      one of the style options, any occurrence of the string '%V' in a
      command in 'TeX-command-list' will be replaced with the third
      element.
 
  -- User Option: TeX-view-style
      List of style options and view options.  This is the predecessor of
      'TeX-output-view-style' which does not provide the possibility to
      specify output file extensions.  It is used as a fallback in case
      none of the alternatives specified in 'TeX-output-view-style'
      match.  In case none of the entries in 'TeX-view-style' match
      either, no suggestion for a viewer is made.