Hello.

## General question

How you can manually load a particular package from Vim-LaTeX in Vim
and how it can be automated for every LaTeX file?

_I am not interested in copying relevant parts from scripts of
particular package to `.vimrc` as a workaround._

## Specific problem

This is just a supplementary part to explain how solving such problem
may be useful.

### Short reminder

In [The Not So Short Introduction to LaTeX
2ε](http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf)
you can read that:

> A tilde ‘~’ character generates a space that cannot be enlarged and 
> additionally
prohibits a line break.

In Polish we should not leave short conjunctions at the end of line.
`~` is helpful here, but writing it after conjunctions is cumbersome
(and spoils the typing flow, and you can just forget about it
sometimes).

[Vim-LaTeX](http://vim-latex.sourceforge.net/) (`vim-latexsuite`
package in debian; _I am using version 20100129-2 in squeeze, just in
case_) provides per package additional customization. For Polish texts
we use package [polski](http://ctan.org/pkg/polski) in LaTeX and its
Vim-LaTeX counterpart modifies space, so it automatically replaces
space with tilde after short words.

### Issue

For larger LaTeX documents splitting text between many files is a
common practice. And here comes the problem with package detection in
Vim-LaTeX. If I open the main `.tex` file (i.e. the one including
other `.tex` files), where `\usepackage{polski}` is present, then
space substitution works fine. It's not the file where you are writing
much, thus it's not really useful here. But if I open any other `.tex`
file (which is included by the main `.tex` file), which obviously does
not have preamble (thereby there is no `\usepackage{polski}` in it),
package detection fails, therefore space substitution is not working
here.

### Partial solution

I have figured out some partial flawed solution.

    au FileType tex call Tex_pack_one('polski')

It's bad because it doesn't work if you open another `.tex` file in
new window (via `:sp` or `:vs` for instance), even if this file have
`\usepackage{polski}` (so it's a regression).

**Simple testing.** Go to insert mode and write `i i i`. You should
see `i~i~i`. Open full LaTeX document (with preamble and
`\usepackage{polski}`) in new window. Repeat the test there. Open
third LaTeX document (w/o preamble) and repeat the test again.

Regards.

P.S. Question has been asked before at SU:
http://superuser.com/questions/284491/manually-loading-package-from-vim-latex-in-vim-because-auto-detection-is-not-alw,
but there is no sign of upcoming answer, so I've ended in here as
rather more appropriate place for such kind of question. If you're by
chance also registered at SU, don't hesitate to cross-answer there.

-- 
Przemysław 'Przemoc' Pawełczyk
http://przemoc.net/

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to