1 automatic-tex-plugin.txt For Vim version 7 Last change: 7 October 2010
3 An Introduction to AUTOMATIC (La)TeX PLUGIN
5 mszamot [AT] gmail [DOT] com
6 ----------------------------------------
8 If you found this plugin useful or you have any kind of problems with running
9 it or some ideas to share, you are cordially invited to write to me:
10 mszamot@gmail.com. Voting at Vim site is also welcome ;) .
12 -----------------------------------------------------------------------------
15 This is a filetype plugin for Vim to comfortably write TeX (LaTeX, PdfLaTeX)
16 documents, which provides functionality not met in other such plugins. It
17 makes you FREE from compiling procedure, making this process automatic using
18 autocommands. It also provides useful mappings and other functions: to analyse
19 your .log file, to see the table contents, to search for a label, to search in
20 bib files or to find a macro definition matching a pattern, or even to find
21 and preview fonts in your tex distribution. The features include an extended
22 tab completion for: commands, environment names, packages, input files, bib
23 files, bst files, colors, closing brackets and environments (preserves
24 nesting),... etc. To have full functionality you need: pdffonts available in
25 the package 'app-text/poppler' (at least in Gentoo). Another good tool is
26 texdoc, which is a part of texlive - these days standard TeX distribution for
27 Linux, and MikTeX on Windows.
28 ------------------------------------------------------------------------------
32 * background compilation with debugging mode
33 * command to make the document (cross references, references, index, tables
34 of contents) |atp-:MakeLatex|,
35 * completion for commands, closing environments (even nested), package names,
36 citations and labels. Support for some latex packages.
38 * table of contents which allows to switch between different sections, files,
39 but also to delete and paste sections:
40 See |atp-:TOC|, |atp-toc-window|,
41 * list of labels which allows to see the context of a label:
43 * a powerful function to search in bibliographic files (bib files):
45 * a command to list ToDo lines:
47 * a command to search for a macro definition (multi-line support):
48 See |atp-:DefiSearch|,
49 * a command to search and PREVIEW fonts in your latex distribution:
50 See |atp-:FontSearch|, and |atp-:FontPreview|,
54 -----------------------------------------------------------------------------
58 |atp-installation| Installation
59 |atp-commands| Functions and commands
60 |atp-toc-window| Commands/maps defined in Table of Contents window
62 |atp-bibsearch| Searching in bib files
63 |atp-completion| How to use and configure completion
64 |atp-omnicompletion| and omnicompletion
65 |atp-configure| How to configure to your needs
66 |atp-ProjectFiles| A note how to write project files within ATP.
67 |atp-ProjectScript| A script executing project specific settings.
68 |atp-mappings| Mappings and Commands
69 |atp-errors| Error handling
70 |atp-editing| Editing tools
71 |atp-requirements| Requirements
72 |atp-viewers| Note about viewers
73 (including inverse and reverse searching for xdvi)
74 |atp-tips| Some tex oriented tips
75 |atp-highlight| Colors and syntax files
76 |atp-remarks| Final remarks
77 |atp-copy-rights| Copy Rights
80 Note on usage: type :help atp<CTRL>d to see all the helptags. To see help tags
81 for all the defined functions :help atp*()<CTRL>d, mappings: :help atp-map<CTRL>d
83 ================================================================================
86 Changes in version 7.6.3
88 - ATP is published on the rights of GLP v3 or higher.
91 imap <Ctrl-j>, imap <Ctrl-k> - these are two motions (based on syntax)
92 which help to navigate throught brackets (but not only) in insert mode.
94 map <Ctrl-j>, map <Ctrl-k> - as above but in normal mode.
96 These motions emulate the behaviour of latex-suite place holder system <++>.
99 - A bug fixed so that the script should now work in any locale (thanks to the
102 - If g:atp_babel is set to 1 the keymap name is shown in the status line.
104 - Project script is written via BufWrite autocommand group (it used to be
105 VimLeave). Both <SID>Compiler() (map \l) and <SID>MakeLatex() (:MakeLatex)
106 functions do not write project file while saving the buffer to the disk.
108 Changes in version 7.6
110 Project Licence: General Public Licence 3.
112 The support of 'latexmk' program is added from LatexBox vim plugin by
113 D. Munger (http://www.vim.org/scripts/script.php?script_id=3109).
114 This includes the commands: :Latexmk, :LatexmkForce, :LatemkStop,
115 :LatexmkStatus, :LatexmkStatusDetailed, :LatexmkClean, :LatexmkCLeanAll.
116 (Now whole, LatexBox plugin is included in ATP - note that some tools have
117 been extended). You can pass options to latexmk using the variable
118 g:LatexBox_latexmk_options. Output type is set by g:LatexBox_output_type
119 (default value is 'pdf').
121 Maps |atp-]]|, |atp-[[|, |atp-][|, |atp-[]| and |atp-]%|, |atp-[%|.
123 Maps |atp-}p|, |atp-{p|, |atp-}c|, |atp-{c|, |atp-}s|, |atp-{s|, |atp-}S|,
124 |atp-{S| which nicely work in visual mode. Previously these maps were
125 <Localleader>np, <LocalLeader>pp. {:} are configurable with two variables:
126 |g:atp_map_forward_motion_leader| and |g:atp_map_backward_motion_leader|.
128 Maps |atp-}i| and |atp-{i| (the same as |atp-]gf| and |atp-[gf|, but
129 shorter). Note that }} maped to } (the same with {{ and {).
131 Maps |atp-}e| and |atp-{e| to go o next/previous environment.
133 |atp-:NInput|, |atp-:PInput| depends on |g:atp_mapNn| (and thus also the
136 |atp-:NSec|, |atp-:NSSec|, |atp-:NChap|, |atp-:NPart|
137 |atp-:PSec|, |atp-:PSSec|, |atp-:PChap|, |atp-:PPart|
138 admits bang "!" (see |:command-bang|). Without bang it skips sections
139 which are commented with bang it doesn't skip them. The 'wrapscan' option
140 applies to these commands (and corresponding maps).
143 vMap c (see |atp-vc|) select comment lines which begin with '^\s*%'.
144 vMap ip (see |atp-vip|) also \newline starts/ends inner paragraph.
146 :BibSearch /{pattern}/ [flag]
147 The command now has the same syntax as |:vimgrep| and |atp-:S|. It is now
148 possible to pass any vim pattern. Note that /.../ can be omitted if the
149 pattern doesn't contain white spaces (you can use |/\s| instead).
150 :BibSearch without any arguments still works (shows all bib files attached
153 The pattern to highlight matching string is made better and is passed to
154 @/ hence you can use |n| and |N| in the BibSearch buffer.
157 If set to 1 (the default is 1), project variables: b:atp_MainFile,
158 b:TreeOfFiles, b:ListOfFiles, b:TypeDict, b:LevelDict will store path
159 relative to |b:atp_ProjectDir| (which is the same as path to
160 your main file, however if the file is a symbolic link it will hint
161 to the resolved path). The |atp-:S| will use correctly these values.
162 This is particulary useful if you want to share the project file.
164 If you run into problems with |atp-:S| you can set this variable to
165 0 and use |atp-:InputFiles| to regenerate the variables - they will
166 now store the full path (the other way around also works).
169 Stores the project direcory, by default where |b:atp_MainFile| is
170 located (the filename is resovled if it is a symbolic link). It is not
171 written to the |atp-ProjectScript| (this makes the |atp-ProjectScript|
172 independent of the host when |g:atp_RelativePath| is set). This
173 variable is mainly for internal purposes. If you want to set the
174 output directory use |b:atp_OutDir|.
177 By default it puts the section after the current one.
179 Changes in version 7.5.3
182 :ShowPackages Command list LaTeX packages defined in the preambule.
184 Completion for Labels, and :Lables command supports subequation
185 environment, which produces labels : 1a, 1b, etc. Syntax group
186 atp_Labals_SectionNr is renamed to atp_Labels_CounterValue.
188 Completion for pseudo algorithms: in algorithmic environment \IF{}:\ENDIF,
189 \FOR{}:\ENDFOR, \WHILE{}:\ENDWHILE are treated as bracket pairs and can be
190 closed using Tab Completion (|atp-completion|).
192 Small change in |atp-:NSec|: it goes to next section, chapter or part,
193 similarly with the other commands.
195 The command |atp-:ToggleEnvironment| supports project files
196 (see|g:atp_toggle_labels| for details.)
198 |b:atp_ReloadOnError| works in project files.
200 There is |atp-:ListPrinters| which does what it sais. (It uses |g:atp_ssh|
201 variable to get the host name to which printers are connected).
203 New wrapers: \overline{:} and \underline{:} (vmaps <LocalLeader>ov and
206 <HISTORY_FEATURE> changed into <PROJECT_SCRIPT>
207 Note: you can remove whole directory ~/.vim/ftplugin/ATP_files/history/
208 It is not used any more.
210 As suggested by user its better to store local history file in the project
211 directory. The project script file which stores local buffer variables is
212 named '<tex_file_name>.project.vim'. The currently used script is stored
213 in the variable b:atp_ProjectScript.
215 Loading procedure searches for files which ends with .project.vim. There
216 might be many such files in one directory. The file is used which contains
217 the current buffer in the list b:ListOfFiles. If none of the files project
218 scripts was containing the current buffer name in b:ListOfFiles then new
219 project script will be written for the current buffer. Before writting the
220 project script file if b:ListOfFiles doesn't exists it will be generated
223 If you want to disable a project script, you can:
224 (1) write in its first line 'finish', or
225 (2) include in it 'let b:atp_History = 0'.
227 If the project script is stored locally the it is easier to include it in
228 a revision system (bzr, svn, etc.) and share it with colaborators.
230 The common history file (which stores two global variables:
231 g:atp_latexpackages, g:atp_latexclasses) is now
232 ~/.vim/ftplugin/ATP_files/common_var.vim
234 If you want to disable project script file and common history file set
235 g:atp_History=0 in your |vimrc| file or |atprc| file.
237 |atprc| file is executed before project script file (with local
238 variables) and common_var.vim files are sourced. Thus the history files
239 will override the settings in |vimrc| and |atprc| files.
241 Variables and command has changed:
242 b:atp_ProjectScritp, g:atp_ProjectScript ( old b:atp_History, g:atp_History)
243 turn on/off Project Script (loading and writting)
244 b:atp_ProjectScriptFile
245 the project script file name which is in use.
246 :LoadProjectScript ( old :LoadHistory)
247 :LoadCommonScript ( old :LoadCommonHistory)
248 :WriteProjectScript ( old :WriteHistory)
249 :WriteCommonScript ( old :WriteTexDistroHistory)
251 g:atp_cached_common_variables and g:atp_cached_local_variables should
252 contain variable names which contain the prefix 'b:' for local buffer
253 variables, 'g:' or '' for global variables, etc... (see
254 |internal-variables|).
256 You can also read |atp-ProjectScript|.
259 Tab completion supports all tikz libraries (as written in pgfmanual.pdf).
262 All toggle commands: |atp-:ToggleAuTex|, |atp-:ToggleSpace|,
263 |atp-:ToggleCheckMathOpened|, |atp-:ToggleCallBack|,
264 |atp-:ToggleDebugMode|, |atp-:ToggleTab|, |atp-:ToggleNn| have an optional
265 argument with value "on" or "off". If not given they toggles the feature.
267 Changes in version 7.5
268 < Tags in help file for variable are now just the variable names, without
269 the 'atp-' prefix (after all almost every variable starts with atp).
270 There is one exception: the LatexBox variables.
272 Other chaneges in |atp-]m|, |g:atp_mapNn|, |atp-:NSec|, |atp-:Open|, |atp-:Babel|, |atp-Compare|,
273 |atp-:SynxTex|, |atp-item| (updated help tags).
275 Changes in version 7.4
276 < See |atp-:NSec|, |atp-visual|(mappings has changed), |atp-:TexDoc|
279 Changes in version 7.3.7
280 < Numerous Fixes + |atp-:DeleteSection|, |atp-:PasteSection|,
281 |atp-:SectionStack| and |atp-:Undo|, |atp-highlight-notification|
284 Changes in version 7.3.4 and 7.3.6
285 < Changes in: |atp-:DefiSearch|, |b:atp_running|, |atp-visual|,
286 |atp-gw|, |atp-g<|, |atp-g>|, |g:atp_sort_completion_list| .
288 See |atp-:GotoFile|, |atp-:S|, |atp-:BibSearch| (updated help tags).
290 New Features in version 7.3.1 (some changes after version 7.3)
291 < Some things works faster in this version: generating the lables and
292 recursive looking for input files (using vimgrep).
294 See: |atp-:GotoFile|, |atp-:MakeLatex|, |atp-:S|, |atp-:ToggleNn|
297 New Features in version 7.2.1
298 < See: |atp-completion-labels|, |atprc|, |atp-debug-mode|,
299 |b:atp_TexFlavor| (updated help tags).
301 New Features in version 7.1
302 < See: |g:atp_MathVimOptions| (updated help tag).
305 ================================================================================
306 INSTALLATION *atp-installation*
308 :filetype plugin on is required to run this plugin, see
309 |:filetype-plugin-on| and |:filetype-indent-on| if you want to have
310 automatic indentation for TeX files. Also |:syntax on| is required as
311 several features (but not basic ones) requieres syntax.
313 To install you just need to copy tex.Vim file to ~your ~/.Vim/ftplugin/
314 directory copy this help file to ~/.Vim/doc and then run :helptags ~/.Vim/doc
315 and that's all, now you can just type your story ... :)
317 If you do not like colors you can still set syntax on but clear the highlight
318 colors (you should make a simple function which clears all the highlight
319 groups, because ':hi clear' will not give you what you want).
322 ================================================================================
323 COMMANDS *atp-commands* *atp-:*
325 The main function is not seen by the user (it is called s:compiler, for those
326 who want to read the plugin). It executes tex compiler specified by the
327 variable b:atp_TexCompiler. It is executed
328 as an autocommand by the line:
329 au! CursorHold $HOME*.tex silent call 's:auTeX()'
330 where s:auTeX() is a simple function which calls s:compiler if the file written
331 on the disk and the buffer differ. There are two comparing mechanism, the
332 default one is using |b:changedtick-variable| , the seconds compares the buffer
333 with the on-disk version:
335 The default value is "changedtick". Then the |b:changedtick-variable|
336 is used to find if there buffer differs and to run latex. With any other
337 value a compare function will be used (which compares the buffer and
338 the written file on the disk) - this method is much slower but has
339 additional features: by defualt differences in comments are skipped
340 (if you set g:atp_compare_embedded_comments = 1 (the default is 0)
341 then also the comments which do not start right at the begging of line
342 will be skipped). The second feature is to not see differences in
343 amount of blank lines: two or more blank lines is the same as one
344 blank line, for this set g:atp_compare_double_empty_lines to 1, which
347 As you can see it will run if a key is not pressed during time defined by
348 option 'updatetime' (see |CursorHold|) in the normal mode. If you type in
349 insert mode the file won't be compiled (and that's alright as you can be in the
350 middle of your very long formula). The value of 'updatetime' which works fine
351 is around 1000ms ('updatetime' is set in milliseconds). Tex compiler is run with
354 which points to a unique temporary file in Vim temporary directory (using the
355 function 'tempname()' (see |tempname()|. If you are concerned with security
356 reasons read also: |shelltemp|.
358 You can switch off/on the function s:auTeX by pressing <S-F5> or by letting
359 the local to buffer variable b:autex=1 (on) b:autex=0 (off). It is useful in
360 some situations turn automatic compiling off. The key <S-F5> calls the function
361 ToggleAuTex() which sets the variable b:autex and issue a message. You can also
362 set this variable to 0 for some files that are not supposed to be processed,
365 au BufRead texmf/*.tex let b:atp_autex=0
367 On start up b:atp_autex is set to 1 if the path of opened file is not under any
368 tex directory ('kpsewhich -show-path tex', except the current dir). For example,
369 files located under your local texmf tree will have b:atp_autex=0.
371 The second important variable b:atp_TexCompiler (see |b:atp_TexCompiler|) configures
372 if you use TeX, PdfTeX, LaTeX, PdfLaTeX and it should point to the program
373 name so please do not use capital letters.
375 Next variable to set is |b:atp_OutDir|. It configures where TeX
376 will put the output and where viewer and log analyzing tools can find
379 The last top most important variable is |g:keep| which is a list of extensions,
381 let g:keep = ["log", "aux", "toc", "bbl"]
382 Files with this extension will be copied from |b:atp_OutDir| to the temporary
383 directory with appropriate name to be used when (La)TeX is compiling. (log file
384 will be only copied after it is created, other files will be copied back and
385 forth between you |b:atp_OutDir| and the temporary directory)
389 By default the call back mechanism is turned on (g:atp_callback=1)
391 When call back mechanism is set, which is by default if you run gui
392 version, if you invoke 'vim' from command line you need to add
393 'servername' variable, it might be desirable to alias vim to to >
395 < you have additional functionalities:
397 * STATUS LINE NOTIFICATION: status line can show if tex is running >
398 let g:atp_status_notification = 1
399 < If unset you will get a message when compiler ends.
400 If set the number next to the name of your compiler indicates
401 how many instances are currently running.
402 * The LOG FILE will be automatically read after compilation.
404 * if t:atp_DebugMode = 'silent'
405 You will not get any message from compilation.
408 After the end of compilation (invoked by the user
409 or autocommand) you will get a message with the
410 return status of the compilator.
412 If you open the error window with :copen or with
413 the menu option ToggleDebugMode then it will be
414 automatically closed after first compilation with
418 Every compilation which is invoked by the user will
419 be run in verbose mode as with <F5> key.
421 Note: the 'verbose' mode in 'vim' (in console) needs to be run, when
422 there is no other latex instance running. Now you get a message to
423 wait until compilation ends. In future releases, a better solution
424 will be worked out. Gui version 'gvim' works better (as it doesn't
427 The background compilation is always done in g:atp_DefaultDebugMode.
428 Unless it is set to 'verbose' in which case 'debug' mode is used.
430 You can invoke compiler in the 'debug' mode with '<LocalLeader>d',
431 '<LocalLeader>l' uses the default mode.
433 :DebugMode {debug-mode} *atp-:DebugMode*
434 Command which help to set b:atp_DebugMode variable (has nice completion).
435 {debug-mode} is one of "silent", "debug", "verbose".
438 *b:atp_ReloadOnError*
439 The variable b:atp_ReloadOnError if set to 1 (which is the default) reload the
440 file even when the exit status of compiler was non zero. If set to 0, then the
441 file will not be reloaded [actually for viewers other than xpdf it will not be
442 copied from the temporary directory, for xpdf it will be copied but not
445 There is also a variable which stores the last command which executed
446 your tex compiler, see |g:atp_TexCommand|.
448 Below I explain commands (functions) which are accesible:
450 :{runs}TEX[!] [debug_mode] *atp-:TEX*
452 If anyway you want to run TeX yourself but you do not want to see the
453 output this is the right tool. This runs TeX in 'nonstopmode'. You can
454 specify an argument {runs} which tells how many consecutive runs of
455 TeX you need (this is important if you want to compile Table of
456 Contents, or index, or the bibliography (see |atp-:Bibtex|)
458 Without "!" it copies the aux file only if there are no compilation
459 errors, with "!" it updates the aux file even if there were errors.
460 This is done to make the labels completion work better, when there are
461 errors they often affect the aux file in a way that interfers with
462 |atp-:Labels| command.
464 If b:atp_OpenViewer=1 and there current viewer (b:Viewer) is not
465 running on the output file then this function will open a viewer. By
466 default b:atp_OpenViewer=0 and this feature is disabled.
468 The command :2TEX will call the compiler two times.
470 It is useful when you want to make the outline (using hyperref
471 package) of your article in pdf files, the tex file has to be
472 'sourced' twice. To make the bibliography you can use |atp-:Bibtex|.
474 If {runs} > 5 it will be reduced to 5, to avoid running tex for hundreds
475 (or event thousands) of times (what could happen otherwise by
476 a mistake giving the range of the command to be the current line
479 The optional argument [debug_mode] has possible valus: '', 'silent',
480 'debug', 'verbose'. When '' the value of g:atp_DefaultDebugMode is
481 used. See the description of |atp-debug-mode|.
483 \d is mapped to :TEX debug and \l to :TEX (thus it uses your default
488 This is equivalent to ':TEX debug'.
492 With one command you can make your whole document: cross references,
493 bibliography (with or without bibtex), index, table of contents, table
494 of figures, table of theorems ([ntheorem package]), table of
495 algorithms. ':MakeLatex!' should be used when an entry from
496 bibliography was deleted (when 'bibtex' is involved this is when you
497 delete last citation command of a bib entry).
499 :ShowErrors [flag] *atp-:ShowErrors*
500 This command shows error/warning messages. It sets the |'errorformat'|
501 variable accordingly to the optional [flag] argument, which is a word
505 w - include all warning messages
506 r - include all reference warnings
507 c - include all citations warnings
508 f - include all font warnings
509 fi - include font info massages
510 F - show files listed in the log
511 (messages which start with 'File: ')
512 shows the files loaded by tex
513 for example fd files that LaTeX is using
514 p - show packages loaded by tex
515 (messages which start with 'Package: ')
516 all - show all the log file
517 o - open the log file in a new buffer (split).
519 If none flag is given 'e' is used. If 'o' flag is uesd the split
520 buffer with log message has a map 'q' to ':bd'.
523 < will show all reference and citation warnings.
525 ShowErrors maps: *atp-:ShowErrors-maps*
527 <F6>+e to see all errors (:ShowErrors e)
528 <F6>+w to see all warnings (:ShowErrors w)
529 <F6>+r to see warnings coming (:ShowErrors rc)
530 from references or citations
531 <F6>+f to see font warnings (:ShowErrors f)
533 this is not a texloganalyzer mapping but it is a good place to mention it:
534 <F6>+l to open log file in a new split window
535 this is a mapping to the |atp-:OpenLog|.
537 :SetErrorFormat {flag} *atp-:SetErrorFormat*
538 This command has the same syntax as :ShowErrors. It only sets the
539 |'erroformat'| variable.
542 :Compiler {compiler-program} *atp-:Compiler*
543 Command which help to set b:atp_TexCompiler variable (with
546 :Bibtex[!] [debug_mode] *atp-:Bibtex*
548 This function will call bibtex to produce the bibliography file
549 (.bbl). If in |b:atp_OutDir| there is no 'aux' file it first calls tex
550 compiler. After the 'bbl' file is produced two consecutive runs of tex
551 compiler are called to make the bibliography.
553 If you specify any value to the [debug_mode] option then then this function
554 will be called in verbose mode (only the last time tex compiler will
555 run in errorstop mode). This gives you the chance to see the output of
556 bibtex command for a second. The command :Bibtex v is associated to
557 this behaviour. If you want to just run bibtex see the next function.
559 The command :Bibtex will :call Bibtex(), while :Bibtex v
560 (and :Bibtex [debug_mode]) will :call Bibtex(1)
562 The bang "!" is used in the same way as for |atp-:TEX| command.
564 For the description of optional argument [debug_mode] see |atp-:TEX|.
566 *g:atp_raw_bibinputs*
567 Tex is looking for the date base files in the path: `kpsewhich
568 -show-path bib`. The variable g:atp_bibinputs contains
569 these directories separated by commas. If atp cannot find your
570 bib file, tex also won't be able.
571 *g:atp_raw_texinputs*
572 Similarly this variable stores all of path reported by `kpsewhich
575 This is a list of directories as g:atp_raw_bibinputs with appended '**'
576 see ':h file-searching'.
578 This is a list of directories as g:atp_raw_texinputs with appended '**'
579 see ':h file-searching'.
581 :ViewOutput *atp-:ViewOutput*
582 map \v,map <F3>, imap <F3>
583 You would like to see what you are editing use this function. It will
584 use the program defined in the variable b:atp_Viewer. See |b:atp_Viewer|,
585 |g:atp_XpdfServer|, |atp-xpdfOptions|. When there is no output file it will run
586 TeX and open the file. Read more about particular viewers
587 (inverse/reverse searching) in |atp-viewers|.
589 :Viewer {viewer-program} *atp-:Viewer*
590 Command which help to set b:atp_Viewer variable (with nice completion).
592 :SetXdvi *atp-:SetXdvi*
593 This command sets the options for xdvi viewer, which enables inverse
594 and reverse searching. It sets the command >
597 < For inverse searching hold CTRL and click left mouse button on
598 the text in xdvi viewer.
600 :SetXpdf *atp-:SetXpdf*
601 This command sets the options for xpdf viewer (as for now the
602 inverse/reverse searching in pdf files is not implemented)
603 It will read the xpdf viewer options from the variables
604 b:atp_xpdfOptions and g:atp_xpdfOptions.
607 :BibSearch /{pattern}/ [flag] see |atp-:BibSearch|
608 This function finds bib entries in bib files defined in your tex file
609 and in the variable b:atp_BibFiles (see |b:atp_BibFiles|), which match the
610 [pattern] (a vim regular expression). The output is configurable by
611 the [flag] argument, see |atp-bibflags|. By default the pattern is
614 :BibChoose see |atp-:BibChoose|
616 This function is defined in the buffer with results of BibSearch
617 command. It is mapped to 'y', 'c' and 'p' and let you copy the bib
618 entry key to a register (see |atp-:BibChoose|) or directly to last
619 opened buffer (after the last cursor position). When you choose to
620 paste, it will close the BibSearch window.
623 :FindBibFiles *atp-:FindBibFiles*
624 This updates the variables s:bibfiles, s:allbibfiles,
625 s:notreadablebibfiles. Finds all bib files defined in all
626 '\bibliography' commands. For more about the above variables read
627 |atp-variables-bib|. This function is called internally be the script
628 functions BibSearch/BibChoose. The command :FindBibFiles finds bib
629 files in the current buffer.
631 If a readable bib file was not found under one of path listed in of
632 g:atp_bibinputs variable (see |g:atp_bibinputs|) it is classified
636 :GotoFile[!] *atp-:GotoFile*
637 :EditInputFile[!] / the old name / *atp-:EditInputFile*
639 This command finds input files under b:atp_MainFile (it is recursive).
640 The nmap 'gf' checks first if there is a file under the cursor. If
641 there is no file under the cursor it list all input files. Input file
642 is one introduced in the source file with \input{<file>}, \input
643 <file> \include{<file>}. The current file is now shown with highlight
644 group: |hl-WarningMsg|.
646 This command uses kpsewhich to find in which path to find input files.
647 Actually the path variables: |g:atp_texinputs| for input files and
648 |g:atp_bibinputs| for bib files are used.
650 The bibliographis declared are also listed. The command searches for
651 them in any directory listed in g:atp_bibinputs (see
654 If g:atp_developer = 1 (default 0) then the map 'gf' can also open
655 package files and document class files, but only when using 'gf' over
656 \usepackage or \documentclass tex commands.
658 With bang "!" this command regenerates tree of files (this is
659 important only in files with input lines), without it uses cached
660 values (if they exist).
662 The current file is now shown with highlight group: |hl-WarningMsg|.
666 If you configure g:atp_LibraryPath, this function will find files
667 matching [pattern] under g:atp_LibraryPath and let them open with
668 a program defined in >
670 < The g:atp_LibraryPath is a comma-separeted list of directory names.
671 You can use wildcards '**' and '*' as in |globpath()|.
672 The default value of g:atp_OpenTypeDict is: >
673 let g:atp_OpenTypeDict = {
674 \ "pdf" : "xpdf", "ps" : "evince",
675 \ "djvu" : "djview", "txt" : "split" ,
676 \ "tex" : "edit", "dvi" : "xdvi -s 5" }
677 < The values of g:atp_OpenTypeDict should be a program to open the file,
678 or one of 'tabe', 'split', 'edit', (if 'vim' is sepcified, then 'tabe'
679 will be used). The cat program is also supported.
681 Found files (all not just matching ones) are stored in the variable
682 g:atp_Library. It is set by |globpath()| on g:atp_LibraryPath and then
683 filtered, only files which extensions are given in g:atp_OpenTypeDict
684 will be stored. This variable is restored by the history common file.
685 You can use {bang} "!" to regenarete the library if it has changed.
686 This is particulary useful as by default ATP remebers g:atp_Library in
687 the common project script (see |atp-ProjectScript|).
689 :ShowErrors o *atp-:OpenLog*
690 :OpenLog, map <F6>l, imap <F6>l
691 Opens log file in a new split window with two options (which are set
692 locally): 'ruler', 'nospell', and a map 'q' to ':bd'.
694 You can also use the command ':Explore' to see log, aux, ... files
695 (which is a part of 'netrw' vim plugin).
698 In the log file there are some special tools to syncronize the tex source file
699 and the Viewer (currently on xpdf is supported) with log file: |atp-:SyncTex|
700 and |atp-:SyncXpdfLog|) These tools can sync tex file/xpdf automatically using
701 autocommand group |CursorMoved|.
705 If you open log file with ':ShowErrors o' command then you can use
706 this command to move to the place in the source code where the error
707 occurs. It works with project files and also can go to error which
708 appear in a declared package. It will go to the first error line
709 declared in the log file below the cursor position (more precisely, to
710 frist line which matches '^l\.\d\+\|on input line\|at lines' will be used).
712 With bang [!] it opens new window if the file with error is not shown
713 in the current tab page. Without bang it opens the file in the window
714 where ':ShowErrors o' was used.
716 If you set g:atp_SyncLog = 1 (the default value is 0) then the source
717 file will be syncronized with the log file via autocommand (with
718 |CursorMoved|). This sets 'cursorline' option to indicate the
719 corresponding line in the source file. When the log buffer becomes
720 hidden this option should be unset.
722 To set g:atp_SyncLog you can use :Sync command. ':Sync' will toggle
723 the value, ':Sync on' will set it to 1 and ':Sync off' will set it
726 If you set g:atp_developer = 1 this command will also go to files
727 under texmf tree (pacakages and classes).
732 If you set g:atp_SyncXpdfLog = 1 (the default value is 0) and you use
733 xpdf as a viewer it will be syncronised with the log file (with
734 autocommand group |CursorMoved|). You can also use the command
735 :SyncXpdf or :Xpdf in the log buffer which does the same.
738 :Delete[!] *atp-:Delete*
740 Deletes all files which extension belongs to g:atp_tex_extensions in
741 the directory |b:atp_OutDir|. By default g:atp_tex_extensions does not
742 contain '.tex', '.pdf', '.dvi' so none of your important files will be
743 deleted. When the command is used with bang it also deletes the
746 :SshPrint [printer], [printer_options] *atp-:SshPrint*
747 It will run 'lpr' command and append to it the options defined in the
748 variable 'g:printeroptions' + options given in the second argument. It
749 prints the pdf or dvi depending on the value of |b:atp_TexCompiler|.
751 If you specify the variable 'g:atp_ssh=<user>@<host>' it will print
752 via ssh on the <host> using the [printer]. The command ':SshPrint' has
753 a completion set for the printers available on your local system or in
754 the host. All the arguments of the command SshPrint are |<f-args>|.
756 Both arguments are optional (the default system printer is used, and
757 only the options 'g:printeroptions' apply).
759 The command has completion for the names of printers (also remote
760 printers), press <Tab> to cycle through printers, or type first
761 letters of the printers name and press <Tab> to complete it.
765 Sends "lpstat -l" remotely (using the |g:atp_ssh| value) or locally and
768 :ListPrinters *atp-:ListPrinters*
769 List printers available on the host |g:atp_ssh|.
772 If g:atp_babel variable is set on start up to 1 (however, the default
773 value is 0, you can use |vimrc| or |atprc| file to switch it on) then
774 ATP will set the |'keymap'| option according to the default babel
775 languege (which is the last language passed to babel as optional
776 argument [lang_list] in \usepackage[lang_list]{babel}).
778 The |g:atp_kemaps| variable is used to translate babel language name
779 to 'keymap' value. The default is something like: >
780 let g:atp_keymaps = {
781 \ 'british' : 'ignore', 'english' : 'ignore',
782 \ 'USenglish' : 'ignore', 'UKenglish' : 'ignore',
783 \ 'american' : 'ignore',
784 \ 'bulgarian' : 'bulgarian-bds', 'croatian' : 'croatian',
785 \ 'czech' : 'czech', 'greek' : 'greek',
786 \ 'plutonikogreek': 'greek', 'hebrew' : 'hebrew',
787 \ 'russian' : 'russian-jcuken', 'serbian' : 'serbian',
788 \ 'slovak' : 'slovak', 'ukrainian' : 'ukrainian-jcuken',
789 \ 'polish' : 'polish-slash' }
790 < When the value is <ignore> then the function <SID>Babel() (or the
791 command |atp-:Babel|) will ignore setting keymap option for this
792 language. Using the above syntax you can set this variable in |vimrc|
795 This is useful if you in day to day work use one language, but some
796 times you write a tex file in some other language.
799 :ShowOptions[!] [pattern]
800 This will show values of variables that are currently set.
801 With bang it also shows global variables defined in
802 'ftplugin/ATP_files/options.vim' (that means almost all global
803 variables). Completion lists are filtered out by default.
805 The optional argument [pattern] is used to filter variables names with
808 TIP: if you are looking for a variable you can use this command to
812 :WrapSelection {beginWrapper}, [endWrapper], [cursor_pos], [new_lines]
814 Puts selected text inside begin_wrapper: [endWrapper] and sets the
815 cursor position according to the variables [cursor_pos]. Possible values
816 are: a number (indicates the character of {beginWrapper} to put the
817 cursor on (see and check vmap \c below), or 'end' put the cursor at
818 the end of [endWrapper] or 'begin' leave the cursor at the beginning
819 (to be precise at the end of the starting wrapper).
820 The default [endWrapper] is '}'. The last argument [new_lines]
821 0/1 (default is 0): if 1 then the begin_wrapper and end_wrapper are put
822 in seperate lines (the begin line and end line are split), this is
823 useful for putting text into and environment \begin{}:\end{}.
825 The command arguments should be separated with commas and quoted
826 separately (see |<args>|).
828 For the predefined maps which use WrapSelection see below
829 |atp-maps-WrapSelection| or use |atp-:HelpVMaps|.
831 *atp-:InteligentWrapSelection*
832 :InteligentWrapSelection {mathWrapperPair}, {textWrapperPair}, [cursor_pos], [new_lines]
834 Puts the selected text inside {mathWrapperPair} if the cursor stands
835 in mathematics otherwise inside {textWrapperPair}.
836 {mathWrapperPair} {textWrapperPair} are vim lists of length at
837 least 1, the first wrapper is the opening and the second is the
838 closing one (if not given the default '}' is used. The other arguments
839 are as for |atp-:WrapSelection|. If the opening leader in is not
840 given then this command is not wrapping the text (see below for the
843 The command arguments should be separated with commas and quoted
844 separately (see |<args>|).
846 For the predefined maps which use WrapSelection see below
847 |atp-maps-InteligentWrapSelection| or use |atp-:HelpVMaps|.
849 *atp-maps-WrapSelection*
850 *atp-maps-InteligentWrapSelection*
851 These are the provided maps in visual mode: >
852 vmap <buffer> \rm :<C-U>InteligentWrapSelection ['\\textrm{'], ['\\mathrm{']<CR>
853 vmap <buffer> \em :<C-U>InteligentWrapSelection ['\\emph{'], ['\\mathit{']<CR>
854 vmap <buffer> \it :<C-U>InteligentWrapSelection ['\\textit{'], ['\\mathit{']<CR>
855 vmap <buffer> \sf :<C-U>InteligentWrapSelection ['\\textsf{'], ['\\mathsf{']<CR>
856 vmap <buffer> \tt :<C-U>InteligentWrapSelection ['\\texttt{'], ['\\mathtt{']<CR>
857 vmap <buffer> \bf :<C-U>InteligentWrapSelection ['\\textbf{'], ['\\mathbf{']<CR>
858 vmap <buffer> \bb :<C-U>InteligentWrapSelection ['\\textbf{'], ['\\mathbb{']<CR>
859 vmap <buffer> \sl :<C-U>WrapSelection '\\textsl{'<CR>
860 vmap <buffer> \sc :<C-U>WrapSelection '\\textsc{'<CR>
861 vmap <buffer> \up :<C-U>WrapSelection '\\textup{'<CR>
862 vmap <buffer> \md :<C-U>WrapSelection '\\textmd{'<CR>
863 vmap <buffer> \un :<C-U>WrapSelection '\\underline{'<CR>
864 vmap <buffer> \ov :<C-U>WrapSelection '\\overline{'<CR>
865 vmap <buffer> \n :<C-U>InteligentWrapSelection ['\\textnormal{'],['\\mathnormal{']<CR>
866 vmap <buffer> \cal :<C-U>InteligentWrapSelection [''],['\\mathcal{']<CR>
867 vmap <LocalLeader>f :WrapSelection '{\usefont{'.g:atp_font_encoding.'}{}{}{}\selectfont ', '}',(len(g:atp_font_encoding)+11)<CR>
869 vmap <buffer> \tx :<C-U>InteligentWrapSelection [''],['\\text{']<CR>
870 vmap <buffer> \in :<C-U>InteligentWrapSelection [''],['\\intertext{']<CR>"
871 < The leader '\' in above commands is configurable: the value of
872 g:atp_vmap_text_font_leader is used (the default is '\').
874 Another provided wrapper: >
875 vmap <buffer> \f :WrapSelection
876 \ '{\\usefont{".g:atp_font_encoding."}{}{}{}\\selectfont ', '}', '(len(g:atp_font_encoding)+11)'<CR>
877 < Where the variable: >
879 < stores the default encoding which is 'OT1', unless you use fontenc
880 package, then the default for fontenc is used (the last defined in
881 \usepackage[...]{fontenc} see the 'Latex2e font selection'
882 /font user guide/ available on CTAN).
885 vmap m :WrapSelection '\(', '\)'<CR>
886 vmap M :WrapSelection '\[', '\]'<CR>
887 vmap <LocalLeader>( :WrapSelection '(', ')', 'begin'<CR>
888 vmap <LocalLeader>[ :WrapSelection '[', ']', 'begin'<CR>
889 vmap <LocalLeader>{ :WrapSelection '{', '}', 'begin'<CR>
890 vmap <LocalLeader>) :WrapSelection '(', ')', 'end'<CR>
891 vmap <LocalLeader>] :WrapSelection '[', ']', 'end'<CR>
892 vmap <LocalLeader>} :WrapSelection '{', '}', 'end'<CR>
893 vmap <LocalLeader>b( :WrapSelection '\left(', '\right)', 'begin'<CR>
894 vmap <LocalLeader>b[ :WrapSelection '\left[', '\right]', 'begin'<CR>
895 vmap <LocalLeader>b( :WrapSelection '\left(', '\right)', 'begin'<CR>
896 vmap <LocalLeader>b[ :WrapSelection '\left[', '\right]', 'end'<CR>
897 vmap <LocalLeader>b{ :WrapSelection '\left{', '\right}', 'end'<CR>
898 vmap <LocalLeader>b{ :WrapSelection '\left{', '\right}', 'end'<CR>
899 < And the maps to put the selected text into an environment: >
900 vmap <LocalLeader>C :WrapSelection '\begin{center}', '\end{center}', '0','1'<CR>
901 vmap <LocalLeader>R :WrapSelection '\begin{flushright}', '\end{flushright}', '0','1'<CR>
902 vmap <LocalLeader>L :WrapSelection '\begin{flushleft}', '\end{flushleft}', '0','1'<CR>
903 < (note that the arguments for this command must be put in ':' or ":")
904 the highlighted text will put inside \textbf{ }.
906 You can also use a wrapper which was yanked into register 'a': >
908 < This will work not only in visual mode. It will operate on last
909 selected text. So if you accidentally lost the selection you can still
910 use this command (but not the maps)!
915 This is a wraper around Align command of the great AutoAlign vim plugin:
916 http://www.vim.org/scripts/script.php?script_id=884.
917 This command sets correct align options and aligns the environment.
918 The following LaTeX environments are supported: >
919 equation, align, alignat, flalign, displaymath and tabular
920 < Equation, align, alignat, flalign and displaymath are checked using
921 syntax, tabular environment is checked using searchpair() function,
922 the g:atp_completion_limits[2] applies.
926 Shows Table of Contents of your document. It do not yet support the
927 started version of chapter, section,... environments.
929 The optional argument bang controls if the table of contents data base
930 must be generated: by default map \t doesn't regenerate the toc data
931 base (unless if it doesn't exist), :TOC command regenerate the
932 data base, :TOC! ]ot.
934 See |atp-toc-window| for commands and maps defined in the toc window.
936 TOC() supports many edited files. For example if you have in your
937 buffer list two files a.tex and b.tex this command will produce table
938 of contents of both of them. If you have just one opened window
939 (excluding the ToC window) then pressing <space>, <enter>, p and q
940 will take you to the right buffer (which will be read if is unloaded
941 or hidden). If you split a window then <space>, <enter>,
942 p, q will take you to the window from which you are coming. However,
943 if you have two windows with two different buffers loaded they will
944 act on the window with the matching buffer name.
946 The variable t:toc_window_width sets the width of table of contents
947 window. By default t:toc_window_width=30. You can set a global
948 variable g:toc_window_width to override the default value.
952 This function returns the name of the currently edited chapter/
953 section/subsection/subsubsection. Use ':echo CTOC()' or just ':CTOC' to
954 see the returned value. If you added a section unit the function will
955 not update the database, run ':TOC' to do that (map \t).
957 :Labels[!] *atp-:Labels*
959 Shows labels defined in your file. You can also use the commands and
960 mappings described in |atp-toc-window|.
962 If you forget what are these mappings, write ':map <buffer>' in the
963 TOC or LABELS window, or move to the end of the LABELS window to see
964 a short help message.
966 The key 's' shows the context of the label under the cursor (your
967 current window splits).
969 The variable t:labels_window_width sets the width of labels window. By
970 default t:labels_window_width=30. You can set a global
971 variable g:labels_window_width to override the default value.
973 Without bang "!" the labels data base will not be generated.
974 Difference of \t and \L is that \L regenerates the database (whichc is
980 Move to next environment, for example ':NEnv definition'. Completion
981 is set, which finds environments defined in current tex source file.
982 This function omits environments in comment lines.
984 If g:atp_mapNn is set to one (see |atp-:ToggleNn|) then this command
990 Move to previous environment, for example ':NEnv definition'. Completion
991 is set, which finds environments defined in current tex source file.
992 This function omits environments in comment lines.
994 If g:atp_mapNn is set to one (see |atp-:ToggleNn|) then this command
998 *atp-:NPart* *atp-}p*
999 *atp-:NChap* *atp-}c*
1000 *atp-:NSec* *atp-}s*
1001 *atp-:NSSec* *atp-}S*
1003 :NPart[!], :NChap[!], :NSec[!], :NSSec[!], :NSSSec[!] [title_pattern]
1004 map }p, map }c, map }s, map }S
1005 vmap }p, vmap }c, vmap }s, vmap }S
1007 Go to next part/chapter/section/subsection/subsubsection which title
1008 matches optionally given [title_pattern]. With bang "!" the command
1009 doesn't skip commented sections. Maps skip them. The search will wrap
1010 around the end of a file if 'wrapscan' is set.
1013 }p :NPart go to next part
1014 }c :NChap go to next chapter
1015 }s :NSec go to next section
1016 }S :NSSec go to next subsection
1018 The leader } can be changed by setting the variable
1019 *g:atp_map_forward_motion_leader* .
1021 Note: the maps work in visual mode and operator pending mode ('d\ns'
1022 will delete till the end of the section). You can use |n| and |N| vim
1023 normal commands (also in visual mode) to go further.
1025 In visual mode these maps go to end of current section or, if already
1026 at the end of section, end of next section.
1028 [title_pattern] is the pattern which will match for the pattern, it
1029 should start with '.*' when you want to match somewhere in a midle of
1032 These commands (and maps) use vim |search()| function or |atp-:S| command
1033 depending on the value of |g:atp_mapNn| (see |atp-:ToggleNn|, when
1034 g:atp_mapNn=1 the |atp-:S| command is used). You can set the value
1035 of |g:atp_mapNn| using the command |atp-:ToggleNn|. If 'wrapscan' is
1036 set and g:atp_mapNn=1 the search will wrap around the end of the project (not the end of
1037 the current buffer).
1039 You can unmap these keys and use <Plug>GotoNextSubSection,
1040 <Plug>GotoNextSection, <Plug>GotoNextChapter, <Plug>GotoNextPart to
1044 *atp-:PPart* *atp-{p*
1045 *atp-:PChap* *atp-{c*
1046 *atp-:PSec* *atp-{s*
1047 *atp-:PSSec* *atp-{S*
1049 :PPart[!], :PChap[!], :PSec[!], :PSSec[!], :PSSSec[!] [title_pattern]
1050 map {p, map {c, map {s, map {S
1051 vmap {p, vmap {c, vmap {s, vmap {S
1053 Go to previous part/chapter/section/subsection/subsubsection which
1054 title matches [title_pattern] (an optional argument). With bang "!"
1055 the command doesn't skip commented sections. Maps skip them. The
1056 search will wrap around the begining of a file if 'wrapscan' is set.
1058 The leader { can be changed by setting the variable
1059 *g:atp_map_backward_motion_leader* .
1061 For descirption of arguments read |atp-:NextSection| just above.
1064 {p :PPart go to previous part
1065 {c :PChap go to previous chapter
1066 {s :PSec go to previous section
1067 {S :PSSec go to previous subsection
1069 These commands (and maps) use vim |search()| function or |atp-:S|
1070 command depending on the value of |g:atp_mapNn| (see |atp-:ToggleNn|,
1071 when g:atp_mapNn=1 the |atp-:S| command is used). If 'wrapscan' is
1072 set and g:atp_mapNn=1 the search will wrap around the beginning of
1073 the project (not the beginning of the current buffer).
1075 You can unmap these keys and use <Plug>GotoPreviousSubSection,
1076 <Plug>GotoPreviousSection, <Plug>GotoPreviousChapter,
1077 <Plug>GotoPreviousPart to define new maps.
1079 ToDo({keyword}, {stop}, [bufname]) *atp-function-ToDo*
1080 :ToDo [bufname] *atp-:ToDo*
1081 :Note [bufname] *atp-:Note*
1082 The function list all the lines of the buffer [bufname] which match
1083 for the pattern '%.*{keyword}'. The {stop} argument is the pattern to
1084 before which to stop. The optional argument is the buffer
1085 name (the buffer name completion is set on). If not given the
1086 current buffer is assumed.
1087 You can set highlighting for this command by:
1088 highlight atp-Todo ctermfg=... guifg=...
1089 The command :ToDo sets keyword='\c\<todo\>' and
1090 stop='\s*%.*\c\<note\>', and the command :Note sets
1091 keyword='\c\<note\>' and stop='\s*%.*\c\<todo\>'. This prevent from
1092 listing ToDo lines with Notes and vice versa.
1094 :ToggleSpace, map <F2> *atp-:ToggleSpace*
1095 This function (command) sets, if it is undefined or removes if it is
1096 defined, the mapping:
1100 which is useful when searching by the command '/', especially if
1101 |'textwidth'| or |'wrapmargin'| is non zero (and |'formatoptions'|
1102 contains one of the flags 't', 'v' or 'b'). Then each <Space> will
1103 match for a space or end of line.
1106 :ToggleStar adds/removes a star from the current
1107 map <LocalLeader>s environment (if it is not one belonging
1109 g:atp_no_star_environments
1111 *atp-:ToggleEnvironment*
1112 :ToggleEnv mapped to <F4> and <S-F4>, switches environment
1113 map <S-F4> name. See (i.e. echo ) g:atp_toggle_environments_1...7
1114 (you can change or add your own variables,
1115 just add numbers - they must be consecutive).
1117 Read |g:atp_toggle_labels| below how it handles the
1120 *atp-:ChangeEnvironment*
1121 :ChangeEnv This does the same as the above command but asks for
1122 map <F4> environment name
1124 Read |g:atp_toggle_labels| below how it handles the
1127 *g:atp_toggle_labels*
1128 The commands |atp-:ToggleEnvironment| and |atp-:ChangeEnvironment|
1129 changes the prefixes of labels (if there is one, which belongs to
1130 g:atp_shortnames_dict) and all ref's (\ref, \eqref and \pageref). You
1131 have to turn on this feature by putting g:atp_toggle_labels=1 (by
1132 default it is 0). Check if it works for you! If there is a label or
1133 reference to which it wants to change it doesn't change labels and
1134 issue a Warning Message, thus I believe it should work for every one,
1135 but as this changes your file it is turned off by default.)
1137 In project files this is done in all files belonging to the project.
1138 Changes are not saved by deafualt (ATP uses |'hidden'| option, so when
1139 you use q! or qa! all changes will be lost).
1141 :SetOutDir *atp-:SetOutDir*
1142 This is a command which sets the |b:atp_OutDir| variable and the
1143 |'errorfile'| option. See |b:atp_OutDir| for the default value.
1145 :SetErrorFile *atp-:SetErrorFile*
1146 If you change |b:atp_OutDir| variable and you want to update the
1147 |'errorfile'| option use this command. It will show you the value to
1148 which |'errorfile'| was set.
1150 :Status[!] *atp-:ATPStatus*
1151 This function (command) sets the status line, which include: the name
1152 of currently eddited chapter (or section) the value of
1153 |b:atp_OutDir| (unless used with bang!) and it will warn you if
1154 |b:atp_OutDir| variable is not set. This function is called at startup
1155 unless the variable 'g:atp_statusline=0' is set. The status is set by
1157 au BufWinEnter *.tex :call Status()
1158 < In this way every opened window with a '*.tex' file will get the correct
1162 :FontSearch[!] [pattern] *atp-:FontSearch*
1166 will list all the fd files in your tex distribution which
1167 names starts with t1 (i.e. which describes fonts in encoding
1169 :FontSearch! bookman
1170 will list all fd files which full path matches 'bookman'.
1172 In the opened window there are several mappings defined:
1173 <Enter> open the fd file under the cursor
1174 <Tab> list fonts defined in the fd file (shows the command
1175 that you can use in your tex file to use this font)
1176 p preview the fonts defined in the fd file under the
1177 cursor, do not shows the latex source.
1178 P preview fonts and show the latex source
1179 (then you can see the errors why the preview was not
1180 produced; in many cases there are no encoding files or
1181 fonts themselves for which you have to look in CTAN
1182 archive yourself; or YOU CAN just SEE HOW TO USE
1184 q close the window (actually, delete the buffer using
1185 :bd, it will be still in the list if you type ":ls!",
1186 so even then you can reload previous searches.)
1188 In addition to 'p' and 'P' maps there is a :Preview command.
1189 Note: the maps 'p' and 'P' work in both normal and visual mode.
1190 You can select a part of the text and use this maps or the command
1191 :Preview to make one preview file for all the font files.
1194 The same mappings are defined in the window with fd file opened
1195 (except <Enter>, <Tab>).
1197 Additionally, read |font-lowlevelcommands| to learn how to use
1198 |\usefont|, |\fontsize|, |\selectfont| and other such commands.
1199 The 'Latex 2e font selection' by 'LeTeX3 Project Team' might be very
1200 useful. It is available on the net (you probably have it in your tex
1201 distribution if it is installed with the documentation, if not check
1204 ATP also has a very nice completion for various font declaration
1205 commands, see |atp-completion-fontdeclaration|.
1207 Hopefully, this will help your documents to become beautiful :)
1210 :FontPreview[!] {fdFile} [encoding] [keep_tex]
1211 Previews all fonts defined in fd file matching the pattern <fd_file>
1212 with encoding [encoding] (optional). If [keep_tex] is 1 (defualt is 0)
1213 it will keep the latex source file for debugging purposes.
1215 Without [!] it matches just the name of the fd files, with [!] the
1216 pattern {fdFile} matches for full path.
1218 It returns a list of fonts which fd files matches the {fdFile} pattern in
1219 [encoding]. You will be asked to chose for which files make a preview,
1220 possible answers are: >
1222 < which is equivalent to >
1224 < you can also mix this notation: >
1226 < As in FontSearch command the [keep_tex] variable specifies if
1227 the source file will be shown (for debugging purposes, or just to look how
1231 *atp-:HelpMathIMaps*
1236 These commands list valid mappings defined by ATP (unless g:no_plugin_maps or
1237 g:no_atp_maps are defined).
1240 Prints PIDs of all running instances of |b:atp_TexComopiler|.
1242 ================================================================================
1243 TABLE OF CONTENTS WINDOW *atp-toc-window*
1245 For the table of contents command and maps read |atp-:TOC|.
1247 The Table of Contents window is used by both |atp-:TOC| and |atp-:Labels|
1250 In the Table of Contents window there are the following nmaps:
1252 'e' to echo the line from your tex file
1253 'y' or 'c' to yank the label of the chapter under the cursor
1254 to a register, if it exists,
1255 'p' to paste it directly to your tex file (just after the
1256 current cursor position),
1257 's' it splits the window with your tex source file and
1258 sets the current line to the beginning of the
1259 chapter/section under the cursor,
1260 'q' to quit, and finaly,
1261 <Enter> to go to the chapter under the cursor and close ToC.
1262 <space> to go to the chapter under the cursor but leave ToC
1265 There are also commands: ':C' and ':P', which do the same as 'c' and
1266 'p' mappings. They all call the function 'Yank(<where>)', the argument
1267 <where> can be one of: '@<register name>' or 'p'.
1269 You can also delete and paste sections using the Table of Contents
1271 *atp-:DeleteSection*
1278 < Using ':DeleteSection' you can delete the section under cursor together
1279 with all its subsections. /Section can be one of: part, chapter,
1280 section, subsection, subsubsection, or bibliography/. Deleted section
1281 will be added to a stack which can be shown using the command
1282 ':SectionStack' There is a command to paste the section from section
1283 stack ':PasteSection'. By default it pastes the most recent element in
1284 the stack. Passing a number will paste that element of the stack
1285 /bear in mind that then numbers of sections in the stack will change/.
1287 ':PasteSection' puts the section just after where current section
1288 ends (section under the cursor in the ToC buffer).
1290 Note: If you use bibtex commands to make bibliography ATP finds the
1291 line which contains '\bibliography' command. And then searches
1292 backward for the first line which is a blank line. The next line is
1293 assumed to be the first line of bibliography. Thus to move the last
1294 section before bibliography or the bibliography itself its better you
1295 put a blank line before bibliography commands. The same applies for
1296 bibliographies put in the middle of document (end of a chapter, part,
1297 etc.) The end of bibliography is found in the same way as the end of
1298 subsubsection. If you use
1299 \begin{thebibliography}:\end{thebibliography} there is no such
1302 If you want to paste a section before the first section, use the line
1307 nnoremap u, nnoremap U, nnoremap g-, nnoremap g+
1308 < You can use undo. The :Undo command will undo in the buffer under
1309 the cursor (it simly switches to the correct window, usese the vim
1310 undo function, and runs :TOC command - so after all your back in
1311 ToC.). The ':Undo' command has one argument - the vim undo command to
1312 use, it is one of: 'u/U/g-/g+' (the default is 'u'). They are mapped
1313 to 'u','U', 'g-' and 'g+'. (only in the ToC buffer). Note: ':Undo'
1314 command doesn't changes the Section Stack.
1316 There is one more level of security: There is a global variable which
1317 stores all the deleted sections together with some information about
1320 < it is a vim list (see |List|). Each entry is a list of the following format: >
1321 [ <title>, <type>, <deleted_section>, <section_nr>, <file> ]
1322 < where <title> is the section title, <type> is one of: part, chapter,
1323 section, subsection, subsubsection bibliography or abstract. Deleted
1324 section is a list of deleted lines, <section_nr> is the number of the
1325 section that it had before deletetion, <file> is the full path to the
1326 file which it comes from. If you need to use it, you can use the vim
1327 function |append()| to put the <deleted_section> in the right place.
1330 You may want to have a map: >
1331 :au FileType toc_atp nnoremap dd :DeleteSection<CR>
1332 < this can be put in your '$HOME/.atp.vim' configuration file.
1333 ================================================================================
1334 SEARCHING IN BIB FILES *atp-bibsearch*
1336 ___________________________
1341 |atp-bibflags:default|
1342 |atp-bibsearch-show-only-keys|
1344 |atp-bibflags:output|
1347 |atp-bibflags:add-flag|
1349 |atp-bibsearch-highlight|
1351 |atp-bibflags:examples|
1352 |atp-bibsearch-variables|
1355 ____________________________
1359 author = { .... }, <-- bib entry |
1360 title = { .... }, > bib field
1361 journal= " .... ", |
1364 article <-- bib field keyword
1365 author,title,... <-- bib entry label
1366 <label> <-- bib field label
1369 One more function is provided which searches the bib files for bib fields,
1370 and for the bib field labels for the latex command \cite{}.
1372 BibSearch({bang}, [pattern], [flags]) *atp-BibSearch*
1373 The function BibSearch allows you to search for the [pattern] in bib
1374 files and opens a new window with results. For the command, please read
1377 {bang} has two possible values "!" or "", with "!" it looks first for
1378 input files, while if {bang}="" only if ATP has not done it yet.
1380 The function BibSearch takes two arguments (the last one is optional).
1381 The first one is the [pattern] to match against each line of the
1382 bibliographic files supplied in the commands \bibliography (if there
1383 are several names,please do not add a white space ' ' after ',' unless
1384 the file name begins with a space, i.e.
1386 \bibliography(Mathematics, Physics,/home/user/Bibliography)
1388 then the plugin will understand that the names of the bib files are
1389 'Mathematics.bib', ' Physics.bib' and '/home/user/Bibliography.bib'.
1393 Before the match all the ligature symbols and {:} are removed. For
1394 example \`a, \' e, \oa,\ea are substituted with a, e, oa, ea
1395 (respectively). Note that the space in \' e is also removed. Each
1396 line (without ligatures) of every bib file found in your tex document
1397 will be matched against the pattern, for example if the pattern is:
1399 'author.*Grothendieck'
1401 the BibSearch function will find all the bibliographic fields
1402 which in one line have the words 'author' and 'Grothendieck' (in most
1403 cases it means that you will see only works of Grothendieck). Another
1406 '^\(\s*author.*Joayl\)\|Galois Theory'
1408 will result in all bib fields which author is Joyal or
1409 which includes the words 'Galois Theory' (which by the way apear in
1410 many article/book titles), yet another example:
1412 'author.*Joayl\|title\p*Galois Theory'
1414 This will match against all bib entries written by Joyal or which title
1415 includes the word 'Galois Theory'.
1417 :call BibSearch('author.*Joyal\&.*Tirney')
1419 will find all the bib entries which were written by Joyal and Tirney
1420 (and maybe somebody else).
1422 For now, there is no possibility to filter bibliographic entries which
1423 both match a pattern in separate lines, i.g. to show all bib entries
1424 written by Joyal on 'Descent Theory'.
1426 Before a match, all '{', and '}' are deleted from the line of the bib file.
1427 But you will see them in the output (what can be useful for debugging
1428 errors in bib files)
1430 Note that in Vim patterns should be quoted using '...' not "...".
1432 Further examples are supplied after the next section
1433 |atp-bibflags:examples|, which describes other functionalities of the
1434 BibSearch/BibChoose commands.
1436 *atp-bibpattern:last*
1437 *atp-bib-b:atp_LastBibPattern*
1438 The variable 'b:atp_LastBibPattern' stores the last pattern used by
1442 The first optional argument [flags] chooses what and in which order
1443 you want to see the bib entries found (entries are listed in
1444 the order they appear in bib file). Flag is a word made of letters.
1445 There are three kinds of flags: entry flags which matches against
1446 labels of bib entries, like author, title, etc..., and keyword flags: which
1447 matches against keywords of bib fields: @article, @book, @techreport,
1448 etc... and two special flags 'All' and 'L'. A flag is a word on
1468 any other letter - do not show anything but the first line of bib entry
1469 @a - article /@article/
1470 @b - book or booklet /@book,@booklet/
1471 @B - Booklet /@booklet/
1472 @c - incollection /@incollection,@inbook/
1473 @p - proceedings, inproceedings, conference /@proceedings,@inproceedings,@conference/
1475 @M - Manual /@manual/
1476 @t - master or PhD thesis /@masterthesis,@phdthesis/
1477 @T - Techreport /@techreport/
1478 @u - unpublished /@unpublished/
1479 All - all flags (see |atp-bibflags:all|)
1480 L - last flags (see |atp-bibflags:last|)
1484 tayu@a --> show the entries: tile, author, year, url of matching articles.
1485 baeP@b --> show the entries: booktitle, author, editor,
1486 publisher of matching books (@book,@booklet).
1488 Flags '@.' are filtered out, if one does not belong to the one above
1489 then it is deleted. You can see which flags are defined using
1490 ShowOptions function/command (they are listed as Available
1492 *atp-bibflags:default*
1493 The default flag is stored in the global variable g:defaultbibflags and is
1494 equal to 'tabejsyu'. This means that the output for each bib field found
1503 if title,author,... are specified in the bibliography for the given
1504 position. If there are many position which match you can set flags to
1505 be as simple as possible to include more lines on the screen. For
1506 example 'tabe' is quite reasonable (note that all bib entries are
1507 matched separately, i.e. if a bib field has both 'title' and 'booktitle'
1508 bib entries it will give you both of them.
1510 *atp-bibsearch-show-only-keys*
1511 If you just want to list just the lines with bib fields keywords:
1512 @article{, @book{, etc. supply a flag which do not belongs to
1513 'g:defaultallbibflags', for example 'X', or 'X@a'
1516 You can also specify flags with '+', for example:
1521 This feature ADDS FLAGS TO THE DEFAULT VALUE defined in the variable
1522 g:defaultbibflags (see |atp-defaulbibflags|). The first will result in
1523 showing the default entries and the page number, the second will
1524 result in showing only books with the default bib entries. You can
1525 specify as many additional flags as you wish. *atp-bibflags:output*
1526 Note that the function shows the line with database file name if there
1527 are entries in this bibliography which match the pattern thus,for
1528 example, if you specify the flag '@a' and you see the line with
1529 database file name, but you do not see any bib entry, then in this
1530 database there are bib fields which match but these are not articles.
1533 The flags='All' is a synonim of flag=g:defaultallbibflags which by default is
1534 equal to'tabejfsvnyPNSohiuHcp' i.e. all flags in this order. If you
1535 add your own flag you should change this global variable. You can add to
1536 this flag any flag which contains '@' (see |atp-bibflags|) by
1537 the plus operator, i.e. All+@a@b or +@aAll will give the same result.
1540 *atp-bib-b:atp_LastBibFlags*
1541 The variable 'b:atp_LastBibFlags' stores the recently used flags. The flag
1542 'L' sets the flags for this search to the value of 'b:atp_LastBibFlags'.
1543 You can write '+L@a', '+L@a', 'L@a' or '@aL' but not '+@La', if you
1544 want to add some flags to previous searches. Next time the flag 'L'
1545 will change the meaning (i.e. it is really the last time not earlier
1546 :) However, there is no '-' :( '-@aL' could be helpful.
1548 The variable 'b:atp_LastBibFlags' is not changed when you use the 'All'
1551 *atp-bibflags:add-flag*
1552 You can add your own flags but not keyword flags (i.e. @a,@b,...).
1553 Just add an entry to the dictionary g:bibflagsdict. (:ShowOptions v to
1554 see its current value), For example
1556 let g:bibflagsdict=extend(g:bibflagsdict,
1557 \ { '<flags_name>' : [ '<bib_entry_name>': '<how_to_show>'] })
1559 where, <flags_name> is the flag to use (it should be one letter), it
1560 must be different from the defined flags, <bib_entry_name> is a
1561 lower case bib entry name, like 'title', 'url', etc., <how_to_show> if
1562 you want to have a nice output put the bib entry name and that much of
1563 white spaces to get 13 strings.
1565 :BibChoose {BibEntry[RegisterName]} *atp-:BibChoose*
1567 This function/command is only available in the window with BibSearch results
1568 and allows to copy a bib entry key to a register or directly to the
1569 last opened buffer (after the cursor position). It is mapped to 'c'
1570 and 'y'. You will be asked to give the number of bib entry to yank:
1572 <bib entry number><register name><Enter> - to copy it to a register
1573 <bib entry number><Enter> - to paste it to 'tex' file
1574 <Enter> - to skip the choice
1576 When you paste the bib entry key the bib search window will close. For
1581 < Copy the bibkey to register e,+ or paste directly to the buffer
1582 in which :BibSearch was invoked, at last cursor position.
1584 The same you will obtain using tha nmaps y or c.
1586 This commands and maps are only in the BibSearch buffer.
1588 *atp-bibsearch-highlight*
1589 The colours of the output are set by the syntax file
1590 'syntax/bibsearch_atp.Vim'. All groups except one are the same as in
1591 the syntax file for bib files ('syntax/bib.Vim' in your $VIMRUNTIME
1592 directory). Their names are 'bibsearchEntryKw' instead 'bibEntryKw'.
1593 The one that is differently defined 'bibsearchComment'. Which is
1594 changed in that way to highlight the bib file names. One additional
1595 highlight group is: 'bibsearchInfo'. It highlights the number of
1596 entry and its line number in the bib file. By default all bibsearch
1597 groups are linked to the corresponding bib group, the bibsearchInfo
1600 In a colour file (~/.Vim/color/*.Vim) you can use these groups to set
1601 colours. See |highlight| or just read a colour file. For example,
1602 this is a nice set of colours for dark background
1605 :BibSearch /{pattern}/ [flag] *atp-:BibSearch*
1606 which do what you expect. The arguments should not be quoted and
1607 separated by a white spaces (if you want to include a white space use
1608 '\ '), for more see |f-args|. If you do not provide any argument then
1609 all entries of all bib files will be shown. Examples:
1611 Some examples: *atp-bibflags:examples*
1614 < Above command shows all bib fields with
1618 < and this is a tip how to show all bib fields with
1619 different flags than the default ones(the '@'
1620 will match at every bib field!). It is
1623 :call BibSearch('','yt')
1625 :BibSearch title[\s.]*Galois Theory aetb
1627 The next one shows all bib fields which were written by Joyal and
1628 Tirney (and may by somebody else).
1630 :BibSearch 'author.*Joyal\&.*Tirney'
1633 :DefiSearch[!] [pattern] *atp-:DefiSearch*
1634 The [pattern] argument is optional. Finds all definitions which
1635 matches the pattern. It looks in the main file (only in the preambule,
1636 unless the optional bang '!' is used) and all the input files (except
1639 The pattern is any vim pattern.
1641 It works likes ]d but handles muliti line definitions.
1643 *atp-bibsearch-variables*
1646 All the values of important variables can be shown by ShowOption
1652 < This variable is a list and you can put here additional bib files.
1653 They will be parsed by the BibSearch/BibChoose functions.
1655 The following variables you can see using the ShowOptions command (see
1656 |atp-ShowOptions|). >
1658 < This variable is a list which stores bib files found in your tex
1659 files and which are readable. It is set up when you first run of the commands:
1660 BibSearch/BibChoose/ShowOptions. Its value is shown by the
1661 functions FindBibFiles({bufname}). >
1663 < this is a sum of found bib files the locally defined b:bibfiles, which
1664 not necessarily are readable. >
1665 s:notreadablebibfiles
1669 -----------------------------------------------------------------------------------
1670 *atp-bibsearch-comments*
1671 Please do not hesitate to report any bug to me:
1674 The algorithm will work only if all kind of bib entries of your bib
1675 file are included in the list g:bibentries. However, changing just
1676 this variable is not enough. In that case the search engine (function
1677 s:search) will produce correct output, but the function which displays
1678 found entries, will not know how to work with the new entries. One
1679 would have to add an entry to the dictionary 'g:bibflagsdict'. If
1680 it is the case, please let me know: mszamot [AT] gmail [DOT] com
1682 As you can see entries of the type '@string' which can be used in bib
1683 files are not supported (i.e. there is no function which substitutes
1684 the variables defined in @string to their values), but it is doable.
1685 @string{ Name = Value }
1688 ================================================================================
1689 COMPLETION *atp-completion*
1691 The completion is by default mapped to <Tab>. For example if you type
1692 \math<Tab> you will get a list of choices which completes this command. (See
1693 ':h popupmenu-completion' and ':h completion' for more).
1695 *atp-completion-expert-mode*
1696 *atp-completion-non-expert-mode*
1697 There are two completion algorithm: expert mode and non expert mode: the
1698 keyword for completion in expert mode must match at the beginning, in non
1699 expert mode any where. Also in expert mode the list of possible completions is
1700 smaler (for example there is no '\lneqq', there is only '\lneq').
1702 Note: Non expert mode doesn't check if you are editing math (see
1703 |g:atp_MathOpened|), and is useful when you want to complete a non-math
1704 command inside mathematics.
1707 If you prefer to not map <Tab> key then you can define g:atp_no_tab_map=1 in
1708 your vimrc file or atprc file |atprc|. Note that vim can add/remove
1709 tabshift witdth from the begining of line in other ways: in normal mode with
1710 |>>| and |<<|, in insert mode: |i_CTRL-T|, |i_CTRL-D| and in visual mode with
1711 |>| and |<|. Also you can use |atp-g>| and |atp-g<|. The alignment of tabular
1712 and other environemnts can be done with |atp-:TexAlign| command.
1714 You can switch off/on completion modes adjusting the variable
1715 'g:atp_completion_active_modes', all names of completion modes are stored in
1716 the variable 'g:atp_tab_completion_modes'.
1718 If 'g:atp_local_completion' is set to non zero value, then input files
1719 will be scanned for \def, \newcommand, \newnevironment and \newtheorem
1720 commands and they will be used for completion. (if its value is 1 then this
1721 will be done during first completion - this is the default, if it is set to
1722 2 then this will be done at start up.
1724 NOTE: if you press <Tab> but then you changed your mind, the
1725 completion pop-up menu allows to cancel completion: press ctrl+p (i.e.
1726 go up - some times more than once) and then press <space>.
1728 Note: Completion checks the preambule for definitions of LaTeX packages. If
1729 a supported package is present (for example: tikz) then the complation will
1730 contain additional commands. If you add a package or a class you should unlet
1731 correponding variable: |g:atp_latexpackages| and |g:atp_latexclasses|.
1736 It is a command to toggle the tab map off/on: :ToggleTab, it is also mapped
1739 Note: see |atp-Tab-note|.
1742 COMPLETION MODES *atp-completion-modes*
1744 commands *atp-completion-commands*
1745 if g:atp_check_if_math_mode = 1 then the pull of commands
1746 contains math commands only if there you are inside a math
1747 environment. This works perfectly if you switch from $:$ and
1748 $$:$$ to their equivalent (and more up-to-date) \(:\) and \[:\].
1749 The list of math environment in which ATP will think you are
1750 editing a math mode is stored in the variable:
1751 'g:atp_math_modes'. Its entries are two element list of
1752 patterns which matches the beginning and end of a math mode.
1753 The '0' entry have to provide the beginning and end pattern of
1754 in line math '\(:\)', the second for displayed math '\[:\]'.
1755 Its default value is given below.
1757 If you add a package (like tikz or amsmath, or amssymb) then
1758 the set of completions will contain extra commands/environment
1759 names defined in these packages Because some classes calls
1760 amsmath package silently setting the variable
1761 'g:atp_amsmath=1' will ensure that you will get completions
1762 for these commands. The algorithm checks if you have this
1763 package declared or if you use some of the standard ams
1764 class (actually checks if the document class name matches
1767 If you do not want math commands completions at all define
1768 ':let g:atp_no_math_command_completion=1' (you can put it in
1769 your |vimrc| or |atprc| file, or define while writing,
1770 both will work, so you can switch off the math completions
1773 The label command completes in a special way: for example in
1775 \begin{theorem}\lab<Tab>
1777 \begin{theorem}\label{thm:
1778 The dictionary of short names is 'g:atp_shortname_dict'. If
1779 you do not likes this idea (however it can help you to
1780 correctly write \ref{ - to avoid referring to lemmas as
1781 propositions, and also it makes completion for \ref{ nicer
1782 - you can list only labels for theorems), so if you do not
1783 want it anyway: 'let g:atp_no_short_names=1' will make the
1787 *atp-variables-local_completion*
1788 *b:atp_LocalCommands*
1789 *g:atp_LocalCommands*
1790 *b:atp_LocalEnvironments*
1791 *g:atp_LocalEnvironments*
1792 By default the first time you are completing an environment
1793 name or a command a list of locally defined environments and
1794 commands is made (it takes a few seconds). If you do not want
1795 to completions for them define "let g:atp_local_completion=0",
1796 if g:atp_local_completion=2" then the search for local
1797 definitions and commands will be done on startup. If you
1798 added a command or an environment the command
1799 :LocalCommands! will update the list of local definitions, but
1800 also the list of packages used by your latex source file
1801 ( completion lists are only used by Tab Completion function if
1802 the package was given, thus it is necessary to run this
1803 command if the preambule has changed)
1804 The output is stored in two variables: >
1805 b:atp_local_commands
1806 b:atp_local_environments
1808 If you use the same set of definitions in every tex file
1810 g:atp_local_commands
1811 g:atp_local_environments
1813 which if defined are used instead of b:atp_local_commands and
1814 b:atp_local_environments (use the command :LocalCommands
1815 to generate the list and then use the command:
1816 :let @a= b:atp_local_commands
1817 i.e. copy the variable to register a and paste it in your Vimrc file.)
1819 There is an extended support for tikz picture environment both
1820 inline \tikz{:} and displayed
1821 \begin{tikzpicture}:\end{tikzpicture}. The completion works
1822 for commands and keywords. The pull of them is enlarged if you
1823 add a tikz library. Yet not all the libraries are
1824 supported but this is just the matter of my time. Normal
1825 commands are added if you are inside {:}.
1828 ref/label/cite *atp-completion-ref*
1829 *atp-completion-label*
1830 *atp-completion-cite*
1831 Tab Completion for Labels
1833 For label completion puts short names, for ref and eqref
1834 commands the completions are the labels found in all files
1835 associated to the main file (the plugin searches the input
1836 and include files for them). The same for cite: which searches
1837 also in bib files defined in the main file.
1839 There is also omnicompletion (CTRL-X CTRL-O, see
1840 |i_CTRL-X_CTRL-O|) for \cite command. Check it out, as it is
1841 very nice (especially in gvim!) and very fast.
1843 For both completion and omnicompletion for the cite command,
1844 the text after \cite{ [ or after a comma after \cite{ ] is
1845 treated as a regular expression. Thus you can wirte:
1847 \cite{.*author1\&.*author2<Tab>
1849 to get the completions for things written by both author 1 and
1850 2 (regardless of the order they appear in bib files).
1852 BibTeX omni completion is triggered by '\cite{', '\citep{' or '\citet{'.
1853 For example, assume you have in your .bib files an entry looking like: >
1856 author = "Donald E. Knuth",
1857 title = "Seminumerical Algorithms",
1858 publisher = "Addison-Wesley",
1863 \cite{Knuth 1981<CTRL-X><CTRL-O>
1864 \cite{algo<CTRL-X><CTRL-O>
1867 \ref{{pattern}<Tab> matches the label name for the {pattern}.
1868 When pattern is matched for a number of a label '^' is added in
1869 front of the pattern (see below). In this case both completion modes:
1870 expert and non-expert works in the same way.
1872 You can also use vim patterns after '\cite{'.
1874 < Tab Completion for labels (|atp-completion|) allows to specify
1875 the number of the counter, e.g. >
1877 < will complete into the label of the counter with value '3.1'.
1878 As for now you can not specify which counter to complete. You
1879 can also write '\ref{3.1$' then '^3.1$' is used as a pattern!
1881 For this two work the aux file must be present. As for now
1882 the aux file, if it is not present, is not made.
1884 This is working with the main document classes: article, book,
1885 review, amsart, amsbook, memoir. If for some class it is not
1886 working thanks for reporting me (it's enough to email me just
1887 the document class).
1889 brackets *atp-completion-brackets*
1890 Closing of brackets {:},{:},[:],(:) (also closes math modes \(:\) and
1892 Relelvant variables are: g:atp_bracket_dict a dictionary of
1893 brackets by default it consists of pairs '(' : ')', '{' : '}',
1894 '[' : ']'. There is a second dictionary g:atp_sizes_of_brackets
1895 which contains all the sizes of brackets in latex plus a pair
1896 '\' : '\', for closing the math modes: \(:\), \[:\] and the
1899 environments *atp-closing-environments*
1900 *atp-completion-env*
1901 Completes after '\begin{' and '\end{'. For example
1902 '\begin{cen<Tab>' will give '\begin{center}'
1903 But '\begin{theorem}<Tab>' or
1904 '\begin{theorem}\label{thm:1}<Tab> will close the environment.
1905 The algorithm tries to close environment in many natural
1906 situations: for example when it did found less than one command
1907 completion. It closes the right environment when they are
1908 nested (however not in right place!) and it preserves the
1909 indention. When after \begin{center}\label{...} XXX is
1910 something (in place of XXX) it will close the environment in
1911 after the cursor position otherwise in next line.
1913 The environments opened in tex definitions ('\def',
1914 '\newcommand', '\renewcommand') will not be closed unless the
1915 current cursor position is in that line (sometimes one might
1916 want to have a definition which only opens an environment).
1920 (the <Tab> indicates in which position the
1921 <Tab> can be pressed to get the described
1936 < Usually the closing comes in the next line,
1937 unless we are inside an environment which is opened
1938 after the non closed environment:
1944 \begin{minipage}<Tab>
1952 < Then the closing will be put just after the last
1953 opened environment closes, or
1968 < If we are outside the theorem environment,
1969 '\end{enumerate}' will be placed just above
1970 '\end{theorem}', and
1972 \begin{theorem}[Joyal\&Tirney]\label{thm:jt}
1980 \end{enumerate}<Tab>
1982 < will put \end{minipage} just above
1983 \begin{enumerate}. Furthermore, if:
1986 \begin{enumerate}\label{enu:1}
1997 \end{enumerate}<Tab>
1999 < '\end{minipage}' will be put just above
2000 '\end{enumerate}'. Furthermore,
2002 \begin{theorem}[...]\label{...} Let \(C\) be a ....
2006 That is, if you like to write \begin{}:\end{} in the beginning
2007 and end of a line this will be preserved. However, there is no
2008 support for nested environments then!
2010 font declarations *atp-completion-fontdeclaration*
2011 This is completion for the commands
2012 \usefont{<encoding>}{<font_familly>}{<font_series>}{<font_shape>},
2013 \fontencoding{<encoding>},
2014 \fontfamily{<font_family>},
2015 \fontseries{<font_series>},
2016 \fontshape{<font_shape>},
2017 \DeclareFixedFont{<cmd>}{<encoding>}{<font_familly>}{<font_series>}{<font_shape>}{<size>}
2019 It first splits the line and take a part between the commands
2020 \selectfont (if there is not \selectfont command this step is
2023 Then if the <encoding> is declared the font families for the
2024 completion will only come from this <encoding>.
2026 If <font_family> is defined, <font_series> and <font_shape>
2027 come from the particular font definition file (the declared
2028 encoding is used if not the value of
2029 |g:atp_font_encoding| is used).
2031 If <font_family> and <font_series> are defined then the
2032 <font_shape> for this font (in the above encoding) is found.
2036 Completion for the command '\bibliographystyle{'. Finds all
2037 "bst" files avaiable in your tex distribution.
2041 Completion for the command '\documentclass'. Returns list of
2042 all classes available in your distribution.
2044 ------------------------------------------------------------------
2045 ATP COMPLETION VARIABLES *atp-completion-variables*
2047 These are all variables which can help to customise the completion:
2048 (if the value is given it is the default, if it is not means it is too long to
2050 *g:atp_completion_limits*
2052 g:atp_completion_limits = [ '40', '60', '80', '100' ]
2054 The above variable specifies how long should
2055 atp plugin search for closed/unclosed environments:
2056 the first value - search for \(:\) [ in line math ]
2057 the second - search for \[:\] [ displayed math ]
2058 the third - search for \begin{<env>:\end{<env>
2059 the fourth - for environments defined in
2060 the variable g:atp_long_environments
2062 You can also put "-1" as the values of
2063 g:atp_completion_limits, then the search
2064 forward/backward will last till first/last
2065 line. However, this makes it run slower.
2066 *g:atp_long_environments*
2068 g:atp_long_environments = []
2070 If some of your environments are very long put
2071 ther names in this list. Do not forget that is
2072 environment <env> is long and is put inside
2073 environment <center> then <center> is alos
2076 However, this will not close long environments
2077 (for that you have to change the third
2078 argument of g:atp_completion_limits !). This
2079 just prevents closiong environments which are
2080 closed and to long to see that.
2082 g:atp_completion_modes = [
2083 \ 'commands', 'inline_math',
2084 \ 'displayed_math', 'package_names',
2085 \ 'tikz_libraries', 'environment_names',
2086 \ 'close_environments' ,'labels',
2087 \ 'bibitems', 'input_files',
2088 \ 'bibfiles', 'bibstyles',
2091 This is the list of completion modes.
2092 *g:atp_completion_active_modes*
2094 g:atp_completion_active_modes = g:atp_completion_modes
2095 < This is the list of completion modes which are
2096 active, by default all modes are active. Remove
2097 a value from this list to make it inactive (You can
2098 use remove() command, see ':h remove()').
2100 g:atp_sort_completion_list = 12
2101 < If the length of completion list for Tab
2102 Completion is longer than this value, entries
2103 will be sorted alphabetically, else they are
2104 provided in, I hope, useful order. If set to
2105 0 the list will not be sorted (if set to 1 it
2106 will be always sorted). >
2108 g:atp_amsmath_environments
2109 g:atp_shortname_dict
2110 < It is used to defin <short_name> in
2111 \label{<short_name><separator>
2112 when completeing the \label command.
2114 g:atp_separator = ':'
2115 < It is used as a separator in:
2116 \label{<short_name><separator>
2117 when completeing the \label command.
2119 g:atp_no_separator = 0
2120 g:atp_env_short_names = 1
2121 g:atp_no_separator_list = ['', 'titlepage']
2125 g:atp_math_commands_non_expert_mode
2126 g:atp_ams_negations_non_expert_mode
2127 < The two last list of commands will be add only in
2128 the non expert mode (|atp-completion-non-expert-mode|).
2130 g:atp_amsmath_commands
2131 g:atp_fancyhdr_commands
2132 g:atp_tikz_environments
2133 g:atp_tikz_libraries
2135 g:atp_completion_truncate = 4
2136 < do not complete commands less than
2137 4 characters (not counting the leading '\' if
2138 present). If 0 then complete all the defined
2139 commands. This only works in the expert mode.
2143 g:atp_MathOpened = 1
2144 < the default value is 1. With the default value
2145 expert mode completion will check if you are
2146 completing inside mathematical environment or
2147 not. Inside math environment only math
2148 commands are completed and outside math
2149 commands are disabled. This makes the set of
2150 completions more acurate. If you need non math
2151 command (like \textrm{}) inside math use non
2152 expert mode (see |atp-completion-non-expert-mode|)
2156 let g:atp_MathZones = [
2157 \ 'texMathZoneV', 'texMathZoneW',
2158 \ 'texMathZoneX', 'texMathZoneY',
2159 \ 'texMathZoneA', 'texMathZoneAS',
2160 \ 'texMathZoneB', 'texMathZoneBS',
2161 \ 'texMathZoneC', 'texMathZoneCS',
2162 \ 'texMathZoneD', 'texMathZoneDS',
2163 \ 'texMathZoneE', 'texMathZoneES',
2164 \ 'texMathZoneF', 'texMathZoneFS',
2165 \ 'texMathZoneG', 'texMathZoneGS',
2166 \ 'texMathZoneH', 'texMathZoneHS',
2167 \ 'texMathZoneI', 'texMathZoneIS',
2168 \ 'texMathZoneJ', 'texMathZoneJS',
2169 \ 'texMathZoneK', 'texMathZoneKS',
2170 \ 'texMathZoneL', 'texMathZoneLS' ]
2171 < the default value in plaintex files is >
2172 g:atp_MathZones = [ 'plaintexMath' ]
2173 < These are zones recongized by tab completion
2174 as mathematical ones (see |g:atp_MathOpened|).
2178 g:atp_no_complete = ['document']
2179 < List of environments which is not closed by
2180 <tab> completion. (The document environment in longer
2181 documents can be not seen by the algorithm as closed,
2182 because it searches only in a part of the text, see
2183 |g:atp_completion_limits| variable above).
2185 g:atp_bracket_dict = { '(' : ')', '{' : '}', '[' : '] }
2186 g:atp_sizes_of_brackets = {'\left': '\right', '\bigl' : '\bigr',
2187 \ '\Bigl' : '\Bigr', '\biggl' : '\biggr' ,
2188 \ '\Biggl' : '\Biggr', '\' : '\' }
2190 *g:atp_latexpackages*
2191 *g:atp_latexclasses*
2195 < stores list of packages and classes in your tex distribution. They are
2196 resored when you exit vim from the common history file (see |atp-history-common|).
2198 They are used for completion of the LaTeX commands \usepackage and
2201 If you reinstall, add or remove tex classes/packages from your tex
2202 distribution it is enough to unlet these variables. ATP will find new
2203 values when it will need them for the first time.
2206 ================================================================================
2207 OMNI-COMPLETION *atp-omnicompletion*
2208 by David Munger (LatexBox plugin)
2210 Completion is achieved through omni completion |compl-omni|, with default
2211 bindings <CTRL-X><CTRL-O>. There are four types of completion:
2215 ------------------------------------------------------------------------------
2217 *atp-omnicompletion-commands*
2220 Command completion is triggered by the '\' character. For example, >
2221 \beg<CTRL-X><CTRL-O>
2225 Associated settings:
2226 |atp-g:LatexBox_completion_commands|
2227 |atp-g:LatexBox_completion_close_braces|
2230 ------------------------------------------------------------------------------
2232 *atp-omnicompletion-environments*
2235 Environment completion is triggered by '\begin{'. For example, >
2236 \begin{it<CTRL-X><CTRL-O>
2240 Completion of '\end{' automatically closes the last open environment.
2242 Associated settings:
2243 |atp-g:LatexBox_completion_environments|
2244 |atp-g:LatexBox_completion_close_braces|
2247 ------------------------------------------------------------------------------
2249 *atp-omnicompletion-labels*
2252 Label completion is triggered by '\ref{' or '\eqref{'. For example, >
2253 \ref{sec:<CTRL-X><CTRL-O>
2254 offers a list of all matching labels, with their associated value and page number.
2255 Labels are read from the aux file, so label completion works only after
2260 \ref{sec:<CTRL-X><CTRL-O>
2262 \eqref{2<CTRL-X><CTRL-O>
2263 < 3. labels and numbers together (separated by whitespace): >
2264 \eqref{eq 2<CTRL-X><CTRL-O>
2267 Associated settings:
2268 |atp-g:LatexBox_ref_pattern|
2269 |atp-g:LatexBox_completion_close_braces|
2272 ------------------------------------------------------------------------------
2274 *atp-omnicompletion-bibtex*
2277 BibTeX completion is triggered by '\cite{', '\citep{' or '\citet{'.
2278 For example, assume you have in your .bib files an entry looking like: >
2281 author = "Donald E. Knuth",
2282 title = "Seminumerical Algorithms",
2283 publisher = "Addison-Wesley",
2288 \cite{Knuth 1981<CTRL-X><CTRL-O>
2289 \cite{algo<CTRL-X><CTRL-O>
2291 You can also use regular expressions (or vim patterns) after '\cite{'.
2293 Associated settings:
2294 *atp-g:LatexBox_cite_pattern* Default: '\\cite\(p\|t\)\?\*\?\_\s*{'
2295 *atp-g:LatexBox_ref_pattern* Default: '\\v\?\(eq\|page\)\?ref\*\?\_\s*{'
2297 Patterns to match \cite and \ref commands for BibTeX and label completion.
2298 Must include the trailing '{'.
2299 To match all commands that contain 'cite' (case insensitive), use: >
2300 let g:LatexBox_cite_pattern = '\c\\\a*cite\a*\*\?\_\s*{'
2301 < To match all commands that end with 'ref' (case insensitive): >
2302 let g:LatexBox_ref_pattern = '\c\\\a*ref\*\?\_\s*{'
2303 < Both examples match commands with a trailing star too.
2305 *atp-g:LatexBox_bibtex_wild_spaces* Default: 1
2307 If nonzero, spaces act as wildcards ('.*') in completion.
2308 For example, if nonzero, >
2310 < is equivalent to >
2313 *atp-g:LatexBox_completion_close_braces* Default: 1
2315 If nonzero, omni completion will add closing brackets where relevant.
2316 For example, if nonzero, >
2321 *atp-g:LatexBox_completion_environments*
2322 *atp-g:LatexBox_completion_commands*
2324 Static completion lists for environments
2325 |atp-omnicompletion-environments| and commands
2326 |atp-omnicompletion-commands|.
2328 ================================================================================
2329 HOW TO CONFIGURE ATP TO YOUR NEEDS *atp-configure*
2332 There are several options you can set, and they might be set in your Vimrc
2333 file. The default values are given below (except the completion setup and
2334 bibtex documented above).
2336 $HOME/.atprc.vim (only on Unix/GnuLinux) or ftplugin/ATP_files/atprc.vim
2337 A configuration file for ATP. You do not have to use autocommands to set
2338 local-buffer variables, just place them here. The settings in atprc file
2339 override the values in history files (|atp-history|).
2341 Tip: If you want to see (almost) all the variables, type ':let g:atp-<CTRL+d>',
2342 and ':let b:<CTRL+d>'.
2344 All buffer variables (see |b:var|), i.e. these which name begins with "b:",
2345 should be set in your Vimrc file. The best way to do that is by using
2348 au BufReadPre *.tex let b:atp_TexCompiler="latex"
2350 If you put just let b:atp_TexCompiler, this will also work but not always: for
2351 example when you open a new buffer in existing Vim session.
2353 let b:atp_TexCompiler = "pdflatex" *b:atp_TexCompiler*
2354 Used by functions: TEX() (map \l, imap \l), VTEX() (map <F5>, imap <F5>)
2356 You can set it to latex, tex, luatex, and so on and possibly to
2359 There is a command to set this variable with nice completion, see
2362 let b:atp_TexFlavor = "tex"
2363 If you are editing a plain tex file it is automatically set to
2364 'plaintex', then you get highlighting for $$:$$. Some other features
2365 are planned (you can also set this while editing a 'tex' file, i.e.
2366 latex document but using $$:$$ is latex is not recommended it is know
2367 to break some latex specific things).
2369 let b:atp_TexOptions = ""
2370 If you want to set some additional options to your tex compiler you can
2371 use this variable, note that -output-directory, and -mode, are
2372 already used. You can use this to make reverse searching with xdvi see
2376 let b:atp_OutDir = fnameescape(fnamemodify(resolve(b:atp_MainFile,":h")) . "/"
2378 This is the directory in which tex will put the output files. If the
2379 open file is not a symbolic link it is equal to the directory in which
2380 the tex file is located. If the open file is a symbolic link it points
2381 to the directory in which the real file is located.
2383 If you set this variable to './' (or '.') and change the current
2384 working directory for example to /tmp (:cd /tmp) then the latex output
2385 will be placed in /tmp, i.e. it will move with with cd. However, the
2386 default value of b:atp_OutDir is not affected by :cd command.
2388 White spaces and other characters should not be escaped. It will be
2389 quoted in '...' using the |shellescape()| function.
2391 You can see the current output directory in the status (it is in the
2392 short notation) to see it whole type:
2394 or use the function ShowOptions() (see |apt-:ShowOptions|).
2396 If in your environment the variable $TEXMFOUTDIR is set the value of
2397 b:atp_OutDir will be set to its value.
2400 WRITING PROJECTS *atp-ProjectFiles*
2403 let b:atp_MainFile = expand("%:p")
2404 < This variable points to the main file of the project, it is set on the
2405 start up to the file you open. If you edit project file (for the first
2406 time), start with the main file and use gf (see |atp-gf|) to go to the
2407 project file you want to edit. In this way all the project files will
2408 have correctly set this variable. The value of this variable is used
2409 by compilation functions. This variable is written in the history file
2410 (see |atp-ProjectScript|). And when the history is on (see
2411 |atp-ProjectScript|,
2412 or set b:atp_History=1) it is restored between sessions. In this way,
2413 next time, you can open any project file and the b:atp_MainFile
2414 variable will be set to the correct value.
2416 The history feature stores more variables: b:TreeOfFiles a dictionary
2417 which contains the tree of input files, b:ListOfFiles - list of input
2418 files, b:TypeDict dictionary of types of input files, where the type
2419 is one of following: {preambule}, {input}, {bib}. The last variable is
2420 b:LevelDict which is a dictionary of input levels (for example: input
2421 files in input file have level 2).
2423 There are other tools to make editing project files more easy. There
2424 is search function: |atp-:S| which works better than the vim |:ijump|
2425 command, which cannot go above the current file in the tree of input
2426 files, but is much faster.
2428 :ToggleNn [on] *atp-:ToggleNn*
2429 The command |atp-:ToggleNn| toggles the value of |g:atp_mapNn| variable.
2430 The optional argument [on] has three possible values: "", "on" or
2431 "off". The default "", toggles the value of |g:atp_mapNn|, "on" sets
2432 g:atp_mapNn to 1 and "off" sets it to 0.
2436 < If it is set to 1 then several tools use |atp-:S| command instead of
2437 vim |search()| function (which looks only in the current buffer).
2439 |atp-:NPart|, |atp-:NChap|, |atp-:NSec|, |atp-:NSSec|, |atp-:NSSSec|,
2440 |atp-:PPart|, |atp-:PChap|, |atp-:PSec|, |atp-:PSSec|, |atp-:PSSSec|,
2444 The default value of |g:atp_mapNn| is 0.
2446 The variable g:atp_mapNn should be always set as follows (in
2447 |atprc| or |vimrc| file): >
2448 if !exists("g:atp_mapNn")
2451 < Then the value will be preserved when atp opens new buffer
2452 when using |atp-:S| command. If you want to have project specific
2453 setting use |atp-ProjectScript|.
2455 Another good tip for LaTeX project files is to set |b:atp_TexFlavor|
2456 variable to 'tex' (in your |vimrc| or |atprc| file). This will prevent
2457 from situations that vim recognizes input file as a plain TeX while it
2458 is an input file into a LaTeX project.
2459 Anotehr way is add options to 'viewoptions' (see |'viewoptions'|). And
2460 set mkview and loadview via autocommands >
2461 au BufWinLeave *.tex mkview
2462 au BufWinEnter *.tex silent loadview
2463 < This will ensure that filetype variable is set correctly. Some ATP tools
2464 behave in a different way in plaintex files. For example TreeOfFiles
2465 function (it makes the variables b:TreeOfFiles, b:ListOfFiles,
2466 b:TypeDict, b:LevelDict). It is recursive in LaTeX files but not in
2467 plain TeX files). On this function is based the command :LocalCommands
2468 which makes list of commands, environments and colors for Tab
2469 Completion and also |atp-:S| command. It is done so, because in plain
2470 tex there is no way to distiguish input files from input packages
2471 which we do not want to scan (especialy recursively, which might be time
2474 PROJECT SCRIPT *atp-ProjectScript*
2475 < The file: |b:atp_MainFile| . ".project.vim", in the same directory as
2476 |b:atp_MainFile| stores values of local variables saved before vim
2477 leaved a buffer (it is very similar to |View|. Local and global
2478 variables are supported. The local variables which are cached in this
2480 let g:atp_cached_local_variables = [
2481 \ 'b:atp_MainFile', 'b:atp_History',
2482 \ 'b:atp_LocalCommands', 'b:atp_LocalColors',
2483 \ 'b:atp_LocalEnvironments', 'bTreeOfFiles',
2484 \ 'b:ListOfFiles', 'b:TypeDict',
2486 < The each file will have separate history file which stores the values
2488 *atp-ProjectScriptCommon*
2489 There is also file for variables for all projects. It stores values of
2490 global variables (by default it is "ftplugin/ATP_files/common_var.vim".
2491 The global variables that are written in this file are given in vim
2493 let g:atp_cached_common_variables = [ 'g:atp_texpackages', 'g:atp_texclasses', 'g:atp_Library' ]
2495 If you want to disable this feature for some reason you can set >
2496 let g:atp_ProjectScript = 0
2498 let b:atp_ProjectScript = 0
2499 < If you want to disable this feature only for a given buffer.
2500 (The value of local variable overrides the value of global one!).
2501 Hint: (if you want to disable loading history for one file):
2502 In your .vimrc file you can set the local variable via
2503 autocommand group BufEnter or you can put an if statement in your
2505 if expadn("%:p") == <path_to_file>
2506 let b:atp_History = 0
2508 < If you want to turn off history file for all buffers use: >
2509 au FileType tex let b:atp_History=0
2510 < in |vimrc| file or 'let b:atp_History = 0' in |atprc| file.
2511 There are these commands: >
2512 :LoadProjectScript[!] [local/common]
2513 :WriteProjectScript[!] [local/common]
2514 :DeleteProjectScript[!] [local/common]
2515 :ToggleProjectScript[!] [on/off]
2516 < which do the obvious thing (if g:atp_History=0 or b:atp_History=0 they
2517 will not work). The default value of the optional argument is "local".
2518 :DeleteHistory [local] command (with optional argument [local]) deletes
2519 the history file for the current buffer (only the local one), with
2520 bang "!" it deletes also common history file. The bang of :WriteHistory
2521 forces to write to history file even when history is turned off
2522 (b:atp_History == 0 or !exists("b:atp_ProjectScript") && g:atp_ProjectScript == 0).
2524 The command ':ToggleProjectScript [on/off]' turns on/off the feature
2525 for this buffer (it sets |b:atp_ProjectScript|). When no argument is
2526 given it will toggle the value. With bang it also sets the global
2527 variable. |b:atp_ProjectScript| is by default in the >
2528 g:atp_cached_local_variables
2529 < so it will be restored afterwards. |b:atp_ProjectScript|if defined
2530 overrides the value of global variable g:atp_History. So you can set
2531 in your atp file g:atp_ProjectScript = 0 and for some files using the
2533 let g:atp_ProjectScript = 0
2534 if expand("%:t") == "myfile.tex"
2535 let b:atp_History = 1
2537 < will turn on the feature only for myfile.tex. Something more elaborate
2538 would be to set b:atp_History only for files with modification time
2539 less than two days for example.
2541 Note: If you delete the history file for the current buffer it will be
2542 written after exiting vim, unless you turn off the history feature.
2544 The project script is disabled for files which full path matches
2545 'texmf'. With the optional bang ':LoadProjectScript common' loads the
2546 common project script also for them. :WriteHistory command will write
2547 the history disregarding if the file is under texmf directory or not.
2549 Note: If you use this feature, you might need to use some times the
2550 commands: |atp-:LocalCommands| and |atp-:InputFiles| which will update
2551 b:atp_LocalCommands, b:atp_LocalColors, b:atp_LocalEnvironments and
2552 b:TreeOfFiles, b:ListOfFiles, b:TypeDict and b:LevelDict. Then use
2553 these commands |atp-:LocalCommands| (with bang "!"), and
2554 |:InputFiles|. The second set of variables is also updated by |atp-:S|
2555 (also with "!") and and |atp-:GotoFile| (with "!" as well).
2557 Note: Also when you add a package to tex you should remove the common
2558 history file, so that the new packages will be added to completion
2562 :S[!] /{pattern}/ [flags]
2563 The pattern is a vim pattern (with 'magic'). With bang "!" it
2564 regenerates the tree of input files.
2566 This is command does the same job as |/| but is recursive in the tree
2567 of files (so it is useful only in project files). The syntax of this
2568 command is similar to |:vimgrep|.
2570 This works similarly to |:ijump|. But also goes back to the root file
2573 It sets the alternate file to the buffer from which the search begun.
2574 Note that this means that if nothing was found the alternate file
2575 before search will be lost.
2577 The {pattern} is any vim pattern as desribed in |pattern| (it was only
2578 tested with 'magic' set on).
2580 The supported [flags] are 'bcewW'. Their meaning is the same as flags
2581 for |search()| function.
2583 You can enclose the pattern with any non-ID character (see
2584 |'isident'|) instead of /, as far as it does not appear in the
2585 {pattern}. Examples: >
2586 :S pattern\_swith\_sspaces
2588 :S pattern with spaces
2591 Note that the function might be slow when the project files where not
2594 There is a function to check where the input file is on the hard drive
2595 if the name in the input command doesn't include the full path. It
2596 asks kpsewhich which directories to search, filters out
2597 directories which are not under '/home' (I assume that there is your
2598 local texmf tree) and also directories which name contains one of the
2599 two keywords 'texlive' and 'kpsewhich'. This makes the searching
2602 Furthermore, the command is designed so that it can find all patterns
2603 '\\input' (and thus easily find next/previous input file). You can
2607 < and you can use |n| and |N| vim normal commands. Note that it if you
2608 go backward, then it means that it will find the most deep line, e.g.:
2613 \input{file.1} ----> -------
2618 < ':S /\\input/ b' in the X position fill find \input{file.1.1} assuming
2619 file.1.1.tex doesn't includes any other file.
2622 The pattern can be '\\input'. Then it goes recursively to the first
2625 *atp-:NInput* *atp-}i* *atp-]gf*
2626 *atp-:PInput* *atp-{i* *atp-[gf*
2627 Now it also doesn't search inside commented input files. There two
2629 :NInput, nmap ]gf, nmap }i
2630 :PInput, nmap [gf, nmap {i
2631 which finds the next/previous input line (also commented). See
2632 |atp-:S_input| to find how it works. They depend on |g:atp_mapNn|, if
2633 1 |atp-S:| is used if 0 vim |search()| function. To repeat search you
2634 can use |n| and |N| vim normal commands. These commands omit comment
2639 let b:atp_auruns = 1
2640 < This variable control how many times the automatic function calls tex
2641 compiler (consecutively). It is useful if you are working with PDF
2642 files and you want to have bookmarks (you can get them using hyperref
2643 package with the option: bookmarks. Then set b:atp_auruns to '2'.
2647 < This variable stores the current number of running instances of latex.
2648 When it is greater than 1 a message in the status line is shown. If :PID
2649 command returns that no latex is running this variable this variable
2652 *g:atp_MathVimOptions*
2654 g:atp_MathVimOptions = { 'textwidth' : '0' }
2655 < This variable is a dictionary of vim settings and its values which
2656 will be valid when you edit mathematics inside the pairs \(:\), $:$,
2657 \[:\], $$:$$ (only in plain tex files or if g:atp_TexFlavour
2658 = 'plaintex'). For example, the default value will toggle between
2659 your 'textwidth' in non-math and 0 in math. The dictionary may
2660 contain short option names equally well as long names.
2662 Note: the standard tex syntax file defines other zones: for example
2663 for align and equation environments (and many others) but some how
2664 they are not accessible using synstack() function.
2666 This feature can be turned off setting variable >
2667 g:atp_SetMathVimOptions
2668 < to '0', the default is '1'.
2669 *g:atp_autex_check_if_closed*
2671 let g:atp_autex_check_if_closed = 1
2672 < This feature is not implemented.
2673 tex run if all environments \begin:\end, \(:\) and \[:\] are closed.
2674 Set g:atp_autex_check_if_closed=0 in order to not make the checks.
2677 let g:texmf = $HOME/texmf
2678 < This variable configures where input files are placed. See
2679 |atp-:EditInputFile|.
2682 let g:askforoutdir = 0
2683 < Its values are 1 and 0. When it is set to 1 you will be asked for the
2684 name of a directory where tex will put output files, note that this
2685 name should end with a "/".
2688 let b:atp_Viewer = "xpdf"
2689 < it was tested with xpdf, evince, epdfviewer, kpdf, okular, xdvi and
2690 they all works fine. I'm using xpdf and the xpdf server options are
2691 supported so that the file is automatically reloaded (other viewers,
2692 except epdfview, have this functionality as well. This do not works
2693 for acroread. Read more about viewers in |atp-viewers|.
2695 If you use program b:atp_Viewer then you can use the variable
2696 b:atp_{b:atp_Viewer}Options to set the options, for example if b:atp_Viewer="xpdf"
2699 *atp-Viewer_Options*
2707 b:atp_evinceOptions, etc ... (and also g:atp_...Options variables)
2708 Used by function: ViewOutput() (map \v, map <F3>, imap <F3>)
2710 For example, if you want to have different look of one document you can
2711 set it to "-bg gray20". Some examples:
2713 let b:atp_xpdfOptions = "-bg Grey30 -mattecolor SlateBlue2 -papercolor White"
2714 let g:atp_xpdfOptions = "-bg NavajoWhite4 -fg black -mattecolor burlywood"
2715 let b:atp_xdviOptions = "-expertmode 0 -s 6"
2719 let b:atp_XpdfServer=fnamemodify(expand("%"),":t")
2720 < Used by function: ViewOutput() (map \v, map <F3>, imap <F3>)
2722 It is equal to the name of the source file. You do not need escape
2723 spaces in the name (shellescape() function is used before it is send
2727 let b:atp_OpenViewer = 1
2728 < If the function which calls TeX compiler do not see that you are
2729 viewing the output file it will open it for you if b:atp_OpenViewer=1.
2730 Otherwise, this feature is disabled.
2733 let g:rmcommand = "perltrash"
2734 < Used by function: Delete() (map <F6>d imap <F6>d)
2736 If you have another 'trash can' program you can use it here, if you do
2737 not have it you can use "rm" (at your own risk). It is used to delete
2738 the files produced by (La)TeX (see |apt-Delete()|). The function
2739 Delete() will remove all files in the output directory (see
2740 |b:atp_OutDir|), which ends with an extension defined in the list
2741 |g:atp_tex_extensions|. If you set:
2745 then the function Delete() (see |apt-Delete()|) will use the Vim
2746 |delete()| command, and will delete only the files produced by the
2747 current '.tex' file. The temporary directory is cleared by rm command.
2749 The program 'perltrash' is in the package app-misc/perltrash (at least
2752 let g:atp_delete_output = 0
2753 < If set to 1 then Delete function (map <F6>d) will delete also the
2756 *g:atp_tex_extensions*
2758 let g:atp_tex_extensions=["aux", "log", "bbl", "blg", "spl", "snm", "nav", "thm", "brf", "out", "toc", "mpx", "idx", "maf", "blg", "glo", "mtc[0-9]", "mtc1[0-9]", "pdfsync" , "ind"]
2760 This list is used by the function Delete() (see |apt-Delete()|) which
2761 deletes all the files with the specified extension in the directory
2762 b:atp_OutDir, unless g:rmcommand="" (see |g:rmcommand|) in which case
2763 Delete() deletes only the output files for the current buffer.
2766 let g:keep = ["log", "aux", "toc", "bbl", "ind"]
2767 < Files with an extension belonging to this list will be copied from
2768 'b:atp_OutDir' to the temporary directory with appropriate name. Then it
2769 will be used by (La)TeX. (log file will be copied after it is created,
2770 other files will be copied back and forth between 'b:atp_OutDir' and the
2771 temporary directory). These four elements: log,aux,toc,bbl are
2772 essentially minimum to work with: table of contents, pdf-bookmarks and
2773 bibtex. There are possibly other classes, like beamer, or packages
2774 like theorem (produce .thm files) which will need to configure this
2777 You can change this variable by the command:
2778 :let g:keep+=["thm","spl"]
2781 let g:printeroptions = ""
2782 < You can set the printer options. These are options for the 'lpr'
2783 command, which will print the output file (pdf or dvi) this depends on
2784 the b:atp_TexCompiler that you use.
2788 < This variable is for debugging purposes. It stores the last executed command to
2789 compile your document. It changes also when your compiler was run
2795 < It is readonly variable.
2797 g:defaultbibflags see |atp-bibflags:default|
2798 g:defaultallbibflags see |atp-bibflags:all|
2799 b:atp_LastBibFlags see |atp-bibflags:last|
2801 b:bibfiles see |atp-variables-bib|
2804 s:notreadablebibfiles
2805 For more on bib flags see |atp-bibflags|.
2807 let t:toc_window_width=30
2808 < g:toc_window_width (by default not set, if set overrides
2810 Configures the initial width of the window with table of contents.
2812 let t:labels_window_width=30
2813 < g:labels_window_width (by default not set, if set overrides
2814 t:labels_window_width)
2815 Configures the initial width of the window with labels.
2818 < by default it is not set, put the line
2820 let g:atp_statusline=0
2822 in your $VIMRC file if you do not want the status line provided by this
2823 plugin. (See |atp-:ATPStatus|).
2825 let b:atp_TruncateStatuSection=40
2826 < This variable sets how many characters of the section/subsection title
2827 (or chapter/section titles if you write a book) should be shown in the
2828 status line. Section title and subsection title gets equal amount of
2832 g:atp_raw_kpsewhich_tex
2833 < This two variables stores the information returned by
2834 'kpsewhich -show-path tex'
2835 They are locked. The first one has pretended '**' wildcards to every
2836 directory, which is done for using with globpath() and findfile()
2839 ================================================================================
2842 Lots of mappings which are given here uses #. This is a convenient map on
2843 British keyboards, but not in the US layout, you can change them for '`' or
2844 some other key that it is not used in Vim (there are not many of them though).
2845 The most commonly used latex-suite plugin uses similar set of mappings (but
2846 there might be some differences). The easy way to change imap leaders is by
2847 using the variables:
2849 g:atp_imap_first_leader == "#"
2850 < for Greak letters, >
2851 g:atp_imap_second_leader == "##"
2852 < for font commands, >
2853 g:atp_imap_third_leader == "]"
2854 < for environments, >
2855 g:atp_imap_fourth_leader == "["
2856 < for extra environments in the old layout.
2857 You can list imaps with |atp-:HelpMathIMaps| and |atp-:HelpEnvIMaps|.
2859 All other mappings (map, vmap, nmap, ...) are using <LocalLeader> which can be
2860 altered with the option |maplocalleader|. A good alternate solution is to use "_"
2863 Maps are using the <buffer> option thus are local to the buffer. To unmap you
2864 also have to use this option, for example to unmap \l issue the command:
2866 :unmap <buffer> <LocalLeader>l
2868 The maps are loaded unless you set one of variables: 'g:no_plugin_maps' or
2869 'g:no_atp_maps' (disables maps defined in tex_atp.Vim), 'g:no_atp_toc_maps'
2870 (disables maps defined in 'toc_atp.Vim'), 'g:atp_no_env_maps' (disables the
2871 environment maps '[*', ']*') or 'g:atp_no_tab_map' (disables the tab map
2872 for completion, then completion is mapped to <F7> and <S-F7> (for the non
2873 expert mode) but there is no map for 'WrapSelection()', you have to provide
2876 Note: in all mappings "\" is set to your <LocalLeader> (and thus, in fact, the
2879 Note: The list of commands might not be complete.
2887 map <F5>,imap <F5>, :VTEX
2890 map \v,map <F3>, imap \v, imap <F3>
2892 :Bibtex[!] run only BibTeX, with bang [!] run LaTeX+BibTeX+LaTeX+LaTeX
2895 :OpenLog, :ShowErrors o
2896 map <F6>l, imap <F6>l
2900 Deletes all the files with an extension which belongs to
2901 g:atp_tex_extensions in the directory b:atp_OutDir. By default
2902 g:atp_tex_extensions does not contain '.tex', '.pdf', '.dvi' so none
2903 of your important files will be deleted. If you set
2904 g:atp_delete_output=1 the function will delete also the current output
2905 file (but not any other!).
2909 This is a mapping to the command ':TOC'
2914 This is a mapping to the command ':Labels'
2916 :GotoFile, :EditInputFile
2920 nmap ]m, nmap [m *atp-[m*
2921 Goto the beginning of next/previous math environment.
2924 nmap ]M, nmap [M *atp-[M*
2925 Goto the beginning of next/previous displayed math environment.
2933 Goto previous \begin{
2945 Goto begin of next comment group
2949 Goto begin of previous comment group
2954 Then you have to type what you are looking for and press enter. The
2955 option 'keywordprg' is set to 'texdoc -m', i.e when your cursor is
2956 over a package name and you press 'K' key then you should see the
2957 package document file (if it is named after the package).
2959 Without any argument it will open "g:atp_TeXdocDefault", by default it
2960 is eqaul to "-a lshort", i.e. "The not so short introduction to LaTeX
2961 2e" by Tobias Oetiker. You can change the default for something that
2962 you use more often, for example you can set it to "-a faq", i.e. 'The
2963 UK TeX FAQ' (or even to "-a lshort faq" if you want them both :).
2967 Goto next input file.
2970 Goto previous input file.
2972 pdffonts is mapped to <F6>g
2973 There is also a command ':PdfFonts' which does the same.
2975 FONT COMMANDS *atp-imap-fonts*
2976 imap ##rm \textrm{}<Left>
2977 imap ##it \textit{}<Left>
2978 imap ##sl \textsl{}<Left>
2979 imap ##sf \textsf{}<Left>
2980 imap ##bf \textbf{}<Left>
2982 imap ##mit \mathit{}<Left>
2983 imap ##mrm \mathrm{}<Left>
2984 imap ##msf \mathsf{}<Left>
2985 imap ##mbf \mathbf{}<Left>
2988 GREEK LETTERS *atp-imap-greek-letters*
2989 Note: you can list this mappings using the command |atp-:HelpMathIMaps|.
3016 Not all upper Greek letters are in LaTeX:
3033 ENVIRONMENT IMAPS *atp-imap-environments*
3034 Note: you can list this mappings using the command |atp-:HelpEnvIMaps|.
3035 imap ]b \begin{}<Left>
3036 imap ]e \end{}<Left>
3037 imap ]c \begin{center}<Cr>\end{center}<Esc>O
3039 imap ]d \begin{definition}<Cr>\end{definition}<Esc>O
3040 imap ]t \begin{theorem}<Cr>\end{theorem}<Esc>O
3041 imap ]P \begin{proposition}<Cr>\end{proposition}<Esc>O
3042 imap ]l \begin{lemma}<Cr>\end{lemma}<Esc>O
3043 imap ]r \begin{remark}<Cr>\end{remark}<Esc>O
3044 imap ]C \begin{corollary}<Cr>\end{corollary}<Esc>O
3045 imap ]p \begin{proof}<Cr>\end{proof}<Esc>O
3046 imap ]x \begin{example}<Cr>\end{example}<Esc>O
3047 imap ]n \begin{note}<Cr>\end{note}<Esc>O
3049 imap ]E \begin{enumerate}<Cr>\end{enumerate}<Esc>O
3050 imap ]I \begin{itemize}<Cr>\end{itemize}<Esc>O
3051 imap ]i \item *atp-item*
3052 This map has more features: if the preceeding line is of the
3055 then using this map in a next line will result with
3057 This will work for other types of items, (1) -> (2), 1) -> 2),
3058 [1] -> [2], 1. -> 2. and also (a) -> (b), b) -> c), [c] -> [d],
3059 but also (1a) -> (1b).
3062 imap ]a \begin{align}<Cr>\end{align}<Esc>O
3063 imap ]q \begin{equation}<Cr>\end{equation}<Esc>O
3065 imap ]L \begin{flushleft}<Cr>\end{flushleft}<Esc>O
3066 imap ]R \begin{flushright}<Cr>\end{flushright}<Esc>O
3068 imap ]T \begin{center}<CR>\begin{tikzpicture}<CR><CR>\end{tikzpicture}<CR>\end{center}<Up><Up>
3069 imap ]f \begin{frame}<Cr>\end{frame}<Esc>O
3071 MATH IMAPS *atp-imap-math*
3072 These are very useful mappings for typing mathematics:
3075 These maps are done like in auctex plugin (the idea and the solution
3076 are taken from there :) and thus it is slightly different than just
3077 a map and works better).
3078 imap ]m \[\]<Left><Left>
3079 imap ]M \[\]<Left><Left>
3081 LOG FILE MAPS *atp-maps-log*
3082 This are available maps in the log file, when it was opened with
3083 |atp-:OpenLog| command >
3084 ]e, [e - go to next/previous error message in log file
3085 ]w, [w - go to next/previous warning message in log file
3086 ]c, [c - go to next/previous citation warning message in log file
3087 ]r, [r - go to next/previous reference warning message in log file
3088 ]i, [i - go to next/previous info message in log file
3089 ]f, [f - go to next/previous font info message in log file
3090 ]p, [p - go to next/previous font package message in log file
3091 ]P, [P - go to next/previous page in log file
3092 % - searchpair for (:).
3093 < You can use |n| and |N| vim normal commands to repeat previous search [count] times.
3095 ================================================================================
3096 DEBUGGING *atp-errors*
3097 This section describes some limitation of ATP (as you see, this section is
3098 not written, but the aim is to make it disapear anyway ;).
3100 *atp-errors-bibsearch*
3101 A possible error which may occur using the :BibSearch commands has a simple
3102 cause: we count number of brackets '()', '{}' and '"' (but nor '\"') to see
3103 where the bib entry ends and where to join lines. The message error is echoed
3104 when more than 30 lines where processed and the matching bracket was not found
3105 (or the number of '"' is odd). Look at your bib file at the specified
3106 position. Syntax highlighting for bib files can help you finding where such
3107 an error is located. (After reading the bib file comment lines and lines which
3108 begin with @string are removed, so that the brackets in comment lines do not
3111 ================================================================================
3112 EDITING TOOLS *atp-editing*
3115 visual mode: ie, iE, ae, im, am, ip, ap, iS, aS, c
3117 They select the current environment in two ways: >
3122 m - math zones: \(:\), $:$, \[:\], $$:$$,
3123 or math environment \begin:\end.
3126 < *atp-vie* *atp-viE* *atp-vae*
3127 ie, iE, ae select environment: from the nearest \begin (top) to the nearest \end (bottom).
3129 'viE' selects a bit more than 'vie' but less than 'vae', it
3130 selects a bracket pair before the beginning of the inner part
3131 of an environment, so it can be environment name or an option
3135 im, am selects mathematics.
3137 ip, ap selects paragraph.
3138 In inner mode: from the nearest >
3139 \begin, \end, \par, \newline or empty line (top)
3141 \begin, \end, \par, \newline or empty line (bottom).
3142 < in outer mode: from the nearest >
3143 \par or empty line (top)
3145 \par or empty line (bottom).
3146 < *atp-viS* *atp-vaS*
3147 iS, aS selects using syntax stack (see |synstack()|), inner is the
3148 top element in the syntax stack (the highlighted area will be
3149 small) and outer uses the most bottom element in the syntax
3150 stack (the resulting are will be wide). Some syntax groups are
3151 filtered out (like 'texDocZone') which not always are
3154 c select comment lines which begin with '^\s*%'. If not in
3155 comment line, end visual mode.
3159 Quite useful normal map: m`vipgq``. It is mapped to gw (in normal
3164 nmaps: g>, g<, 2g>, ..., 6g>
3165 A normal map to m`vipg>`` (or m`vip2g>``).
3169 ================================================================================
3170 REQUIREMENTS *atp-requirements*
3172 This plugin requires Vim version higher than 7. Several tools uses syntax, so
3173 even if you do not like colors on the screen you should set "syntax on". For
3174 example, the recognition of math mode used by |atp-completion|, and
3175 |atp-:TexAlign| command (but also some other things).
3177 It is nice to have 'texdoc' program. This plugin maps <F1> to a function which
3178 calls it. This allows to speed up searches for documentation. Also the option
3179 'keywordprg' has the value "texdoc -m", thus pressing 'K' (see |K|) over a tex
3180 package should open you the package documentation. The same applies to this
3183 Another good programs are: texloganalyzer (which is now not used by ATP) and pdffonts
3184 There is a map to use pdffonts, see: |pdffonts|.
3186 ================================================================================
3187 NOTES ON VIEWERS *atp-viewers*
3190 xpdf *atp-viewers-xpdf*
3191 It is fully supported. It is configured in the way that when your tex
3192 file have errors, xpdf viewer will not reload your file, which I found
3195 You can set your own options of xpdf using b:XpdfOptions, for example
3197 let b:atp_xpdfOptions="-bg NavajoWhite4 -fg black -mattecolor burylwood"
3199 will make xpdf view different. This is helpful when you edit to
3200 files, and do not want to xpdf mix them. Another example:
3202 let b:atp_xpdfOptions="-bg Grey30 -mattecolor SlateBlue2 -papercolor White"
3206 *atp-viewers-okular*
3208 Works fine. Note that okular has supports syncing in pdf. Just use
3209 'pdfsync' package ('\usepackage{pdfsync}') and set the option in
3211 settings>Configure Okular>Editor
3213 Editor Custom Text Editor
3214 Command gvim --servername GVIM --remote-expr "atplib#FindAndOpen('%f','%l')"
3215 < Then you can use <Shift>+<Left_Mouse> in okular to syncronize the gvim
3216 with pdf. This syncing is not 100% accurate and you can find on the
3217 pdfsync web-page that this is not a bug. For me syncing in xdvi works
3220 The function atplib#FindAndOpen asks each running gvim server if is is
3221 "hosting" source of the file %f. Then it uses this server to set the
3222 line (but it doesn't check if the cursor is in the right window!).
3225 The function 'atplib#FindAndOpen' will not start gvim if it is not
3228 Alternative configuration would be to run okular from vim and
3229 set the Command to >
3230 Command gvim --servername GVIM --remote-wait +%l %f
3231 < but I don't know how to set this from the command line. If you know,
3232 Many Thanks for Reporting!
3236 Works fine (moves page a little bit when updates a file).
3238 This viewer does not support automatic reloads when the file changes
3239 (but it seems that the work is in progress). You have to issue CTRL-R
3240 yourself when the file is changed.
3242 As with epdfview (with the difference that it supports automatic
3243 updates, but it do not works somehow)
3245 xdvi *atp-viewers-xdvi*
3246 *atp-viewers-xdvi-reverse/inverse-searching*
3247 Works fine. The file will be updated after a click (or use the xdvi
3248 options '-watchfile 1' see man xdvi for explanations). You can set
3249 inverse/reverse searching by the command |SetXdvi|. It is recommended
3250 to use gVim rather than Vim, if you want to use Vim you have to run it
3252 vim --servername xdvi <file>
3253 < You can pick any server name.
3255 The command SetXdvi defines a new function:
3257 RevSearch() *atp-:RevSearch*
3259 Which makes an reverse search (sets the xdvi position according to the
3260 cursor position in gVim).
3262 Here I describe how inverse/reverse searching is done.
3264 (1) Inverse searching
3265 (i.e. position Vim's cursor after xdvi event:
3266 usually CTRL+Left Mouse) with this options:
3268 let b:atp_TexCompiler = "latex"
3269 let b:atp_TexOptions = "-src-specials"
3270 let b:atp_Viewer = "xdvi -editor 'gvim --remote-wait +%l %f'"
3272 See Vim tip at: http://Vim.wikia.com/wiki/Vim_can_interact_with_xdvi
3274 (2) Reverse searching
3275 For reverse searching (position xdvi according to the Vim's cursor
3276 position) you can set:
3278 let b:reverse_search="xdvi -sourceposition " . line(".") . ":" . col(".") . fnamemodify(expand("%"),":p") . " " . fnamemodify(expand("%"),":p:r") . ".dvi"
3280 To make an reverse search:
3282 :call system(b:reverse_search)
3284 And xdvi will place itself at the current cursor position in the 'tex'
3285 source file. You can make a map for this.
3287 To use this with Vim one have to add server name. Run
3290 vim --servername VimTeX
3291 let b:atp_Viewer="xdvi -editor 'vim --servername " . v:servername . " --remote-wait +%l %f'"
3292 let b:reverse_search="xdvi -editdor 'vim --servername " . v:servername "' -sourceposition " . line(".") . ":" . col(".") . fnamemodify(expand("%"),":p") . " " . fnamemodify(expand("%"),":p:r") . ".dvi"
3294 In case of troubles:
3297 If reverse searching do not works for you, and you get an error, that
3298 there is no reference to your tex file in the dvi file, then open
3299 your dvi file in an editor (Vim :) and check what is the name after
3300 'src:<line number>' (this are the source specials put by 'latex
3301 -src-specials' command). It should refer to your tex file. Xdvi
3302 will not recognize if you specify the full name of the tex file (i.e.
3303 with path) in the b:reverse_search (as we do above using the
3304 modifier :p and the function fnamemodify in
3305 'fnamemodify(expand("%"),":p")' the other one with ":p:r" is OK!)
3306 and in the dvi file there is written just the name without the
3307 path (and vice versa, if you give just the name in
3308 b:reverse_search and in the file there is full path).
3310 There is an excellent web pages on inverse/reverse searching with
3312 http://xdvi.sourceforge.net/inverse-search.html
3313 < 'tip': You can put in your atprc file |atprc| file >
3314 au BufEnter *.tex :SetXdvi
3315 < 'tip': If you want to change the name of the command this is also
3316 possible for example by putting in you atprc file: >
3318 au VimEnter *tex delcommand SetXdvi
3319 au VimEnter *tex delcommand SetXpdf
3321 command! -buffer Xdvi :call SetXdvi()
3322 command! -buffer Xpdf :call SetXpdf()
3325 ================================================================================
3328 If you have any nice tip on editing (La)TeX with vim or ATP :) you can share it
3329 here (my email you'll find on top of the help file), or put them on the script
3332 :g/^[^%]*\\usepackge/# List loaded packages with line numbers
3334 y/\\begin{document}/ When standing on 1st line - copy the preambule
3335 (possibly to a register)
3336 :g/^\s*%/d Delete comment lines
3338 :g/\(^\s*\n\)\{2,}/d Compress empty lines
3339 / when there are more than two empty
3340 lines it leaves just one /
3342 vipgq Format inner paragraph. Or even better:
3343 m`vipgq`` This is so nice that I added a map: >
3347 m`vip<`` Indent inner paragraph, they are mapped to: >
3350 < There are also defined maps: 2g>, 3g> , 4g>
3353 :TeXdoc ams<Ctrl-d> Show tex documentation which matches ams (the
3354 completion for TeXdoc command finds matches in
3355 alias files of texdoc :!texdoc -f).
3356 \ref{^thm:<Tab> will list all cross references to theorems (if
3357 you use the prefix thm: for theorems.
3359 If you want to change the name of a command,
3362 au VimEnter *tex delcommand SetXdvi
3363 au VimEnter *tex delcommand SetXpdf
3365 command! -buffer Xdvi :call SetXdvi()
3366 command! -buffer Xpdf :call SetXpdf()
3368 However, not all functions are defined without
3369 <SID> (you can always try to reach me).
3371 :'<,'>WrapSelection @q Wrap a visual area with wrapper from the
3372 register q and with the default '}' end
3374 :'<,'>WrapSelection @q,@w As above but with the end wrapper from
3377 :map ]= ]sz= Goto the first spelling error and list
3378 :map [= [sz= suggestions. Another version is to use
3379 ]S and [S instead of ]s and [s.
3382 ================================================================================
3383 COLOUR HIGHLIGHTING AND SYNTAX GROUPS *atp-highlight*
3385 When the cursor is positioned on \begin{envname} or \end{envname} both
3386 corresponding \begin:\end get highlighted with syntax group MatchParen.
3387 To disable it type this in ex mode or put it in your atprc file: >
3388 augroup LatexBox_HighlightPairs
3393 There is a color scheme included: coots-beauty-256. You need 256 colors to use
3394 it (in the terminal).
3396 These are the highlights groups defined for various files and the default
3400 highlight atp_FileName Title
3401 highlight atp_LineNr LineNr
3402 highlight atp_Number Number
3403 highlight atp_Chapter Label
3404 highlight atp_Section Label
3405 highlight atp_SubSection Label
3406 highlight atp_Abstract Label
3407 < *this group highlights abstract and all the unnubered chapters
3408 and the bibliography.
3410 The chapter group highlights or chapters, or sections, or parts, depending
3411 what is your top level section in your latex document. This applies,
3412 accordingly, to other groups.
3415 highlight atp_label_FileName Title
3416 highlight atp_label_LineNr LineNr
3417 highlight atp_label_Name Label
3418 highlight atp_label_Counter Keyword
3421 this is very much the same as the standard syntax for bib files. Groups
3422 are named bibsearch<NAME> instead of bib<NAME>. There is one more group
3425 highlight bibsearchInfo
3427 which highlights the line number of the bib entry in the bib file. All
3428 bibsearch groups are by default linked to the bib groups.
3430 Yet, there is no default highlighting, try coots-beauty-256 color scheme.
3431 If you like it, I'm glad, if you have a nice (non standard) color scheme,
3432 I'm happy to get it, if you like to share it.
3435 The notification message that your compiler is running can be highlighted.
3436 For this set the variables: >
3437 g:atp_notification_{g:colors_name}_gui
3438 g:atp_notification_{g:colors_name}_guifg
3439 g:atp_notification_{g:colors_name}_guibg
3440 < Their values will be passed to gui guifg and guibg values of the highlight
3441 command. The g:colors_name variable is set by color scheme. Usually it is
3442 just the color scheme name but there might be a difference, for example:
3443 the provided color scheme file name is 'coots-beauty-256' but the variable
3444 is set to 'coots_beauty_256'. Example: >
3445 let g:atp_notification_coots_beauty_256_gui="DeepPink4"
3446 < will set the foreground color of 'pdfLaTeX' message to DeepPink4.
3448 *atp-highlight-notification*
3449 The status message 'LaTeX' ( if you use latex or 'pdfLaTeX' when you use
3450 pdflatex, and so on) can be highlighted. There are several variables to
3452 g:atp_notification_{g:colors_name}_gui
3453 g:atp_notification_{g:colors_name}_guifg
3454 g:atp_notification_{g:colors_name}_guibg
3456 g:atp_notification_{g:colors_name}_cterm
3457 g:atp_notification_{g:colors_name}_ctermfg
3458 g:atp_notification_{g:colors_name}_ctermbg
3459 < where g:colors_name is the name of the color scheme, for example the
3460 supplied color scheme with atp 'runtimepath/colors/coots-beauty-256' has
3461 name 'coots_beauty_256' so the first variable should be >
3462 g:atp_highlight_coots_beauty_256_gui
3463 < value of these variables are used to set highlight for the group UserN
3464 where N is the value of g:atp_statusNotifHi. Its value should be
3465 0,1,...,9. Where 0 means no highlight for status notification (which is
3466 the default). If it is set to positive value then the default values of
3467 these variables should give the same color as the status line has.
3469 The variable g:atp_StatusLine is stores the value of vim option
3470 'statusline'; actually 'statusline' option is set by: >
3471 set statusline=%!g:atp_StatusLine
3474 ================================================================================
3475 FINAL REMARKS *atp-remarks*
3477 To see some messages that are issued you can use :messages command
3480 If you find this plugin useful and have some comments you are
3481 cordially invited to write to the author: <mszamot@gmail.com>.
3483 There are other ways to make such an automatic plugin. The crucial
3484 step is to make the plugin know that tex is already in use (if you run
3485 to tex compilers on the same file at the same time the effect won't be
3488 For several month I was using a different code which was not using
3489 temporary copies but was checking if the tex is running or not. It was
3490 working very good but I didn't understand why (silly isn't it), and
3491 when I started making changes it stopped working: the issue is that
3492 it is difficult to make a function sleep until tex stops working not
3493 putting whole Vim into sleep - this is the time that we want to save.
3494 However, the advantage of using temporary files is smoothness (changes
3495 appear faster in the output file).
3497 Best regards, and hopefully you will find this useful :)
3501 ================================================================================
3502 COPY RIGHTS *atp-copy-rights*
3505 " Copyright: Copyright (C) 2010 Marcin Szamotulski Permission is hereby
3506 " granted to use and distribute this code, with or without
3507 " modifications, provided that this copyright notice is copied
3508 " with it. Like anything else that's free, Automatic TeX Plugin
3509 " is provided *as is* and comes with no warranty of any kind,
3510 " either expressed or implied. By using this plugin, you agree
3511 " that in no event will the copyright holder be liable for any
3512 " damages resulting from the use of this software.
3515 im:tw=75:ts=8:ft=help:norl: