A year ago, I was using msysgit on M$ Win* 7. Its support for Unicode characters isn’t so good, and I can’t write a text file with accents like “café” in the Vim editor that shipped with msysgit. As a result, I needed GVim for editing my $\rm \LaTeX$ documents.
Unluckily, unlike Linux, the GVim can never have forward control. Therefore, I needed to switch windows between GVim and Git Bash.
More importantly, if I want to apply the Linux skills and the tools on M$ Win*, I need portable programs excutable on a USB unless I carry my laptop.
Luckily, the bash shell in Git for Windows has improved a lot. The accents are well supported. Then, I have switched from GVim to the embedded Vim in Git for Windows. Luckily, the setup of Vundle was smooth. Most of the installed plugins work fine in terminal Vim.
In the post Git Portable Home Path, a BAT file is included so
that the home folder and the HOMEDRIVE
environment are automatically
set. Since the same Git repository can be shared among multiple
devices, such as my Linux desktop, my M$ Win* 7 laptop, and my USB
stick, a bare repository is needed for efficient pulling and pushing
of Git commits. Since I work outside home, I place a bare Git repo in
my USB stick. However, for each local Git repository stored in the
USB stick (under ~/local_repo
, a.k.a.
$HOMEDRIVE/PortableGit/home/owner/local_repo
), I need to run the
following command for each time I use Git Bash.
After making some changes on a $\rm \TeX$ file, I compiled the file using Mik$\rm \TeX$ Portable.
$HOMEDRIVE/MikTeXPortable/
.miktex-portable.cmd
.$HOMEDRIVE/PortableGit/home/owner/local_repo
.pdflatex file.tex
.This sounds really slow. The goal is to find a more efficient $\rm \LaTeX$ editing workflow.
That’s not the end. Another bad news came from eu1lmr.fd
. I’ve
got error similar to fengbaobao6’s. The compilation was
stuck at ...\tex\latex\euenc\eu1lmr.fd
. Then an error was shown:
“Fontconfig error: Cannot load config file”.
~/.bashrc
if it doesn’t exist.Searching the error text, I found kounoupis’s answer on
Ask Ubuntu. Even though the export
command didn’t
work for me, I still found his answer informative.
Finally, reading miktex-portable.cmd
, I gave up on investigating the
problem, and added the last line of this file into BASHRC since I have
other important things to do.
1
2
3
@echo off
cd /d %~dp0
miktex\bin\miktex-taskbar-icon.exe
To include Mik$\rm \TeX$ into PATH
, I first extracted $HOMEDRIVE
in the form /f
instead of F:/
. If not, Mik$\rm \TeX$ won’t
work.
Here’s my BASHRC for Git Bash.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
stty -ixon
cd ~
HOMEDRIVE=$(perl -e '($var) = $ENV{HOMEDRIVE} =~ /([A-Z]):/; print "/".lc($1)')
if [ $(perl -e '($var) = $ENV{PATH} !~ /tex/i; print STDOUT $var') ]
then
echo "No LaTeX found! Added $HOMEDRIVE/MikTeXPortable/miktex/bin
to path."
PATH=$PATH:$HOMEDRIVE/MikTeXPortable/miktex/bin
echo "IMPORTANT: Close MikTeX Taskbar icon before exit."
echo "Otherwise this shell WON'T close."
miktex-taskbar-icon
fi
loc_repo=(
'resume2015'
)
for f in ${loc_repo[@]}; do
cd $f
git remote set-url origin $HOMEDRIVE/$f.git
cd -
done
If the setup is correct, then \ll
in $\rm \LaTeX$-Suite should
automatically trigger the $\rm \LaTeX$ compilation. I give up on
finding ways to open a viewer with \lv
since I can use the keyboard
to switch to a web browser to see the compiled PDF file without
installing another PDF viewer in my USB stick.
I’ve learnt some Perl and bash after writing this BASHRC.
$ENV{HOMEDRIVE}
for extracting the environment variable
HOMEDRIVE
./(regex_pat)/;
for extracting matching string to capture
groups $1
, $2
… (The ()
around regex_pat
is
crucial.).
for string concatenation.lc()
for converting a string to lowercase.I use Byobu with Tmux backend.1
I find two articles on Giant Robots very useful.
Therefore, I followed the steps in the first blog post, and installed Vim Tmux Navigator.
After the installation of the Vim plugin, I got another problem while
editing my VIMRC: The {Down-Mapping}
didn’t work.
Vim-$\rm \LaTeX$ should know the reason. I found an
article describing a similar problem.2 However, I wouldn’t
like to change ~/.vim/bundle/vim-latex/plugin/imaps.vim
, so I got
stuck at this point for hours. I tried to substitute {Down-Mapping}
with <C-a>j
in VIMRC, but it didn’t work.
Accept simple ways to do things
Even though I can’t set {Down-Mapping}
to <C-j>
, the Vim
editor command :TmuxNavigateDown
isn’t so hard to type. I
failed to realise that typing :tm<Tab>
will do, and wasted time
on that. Now I accept the use of two different sets of
keystrokes for switching to the Tmux pane/Vim buffer below. We
can look at this problem from another angle.
Store a list of windows in a file
A sample file can be found on Super User.3 I found that if I
had run Byobu before, a session 0
would also be created on top
of tmuxs
. To avoid this problem, remove the first line in the
sample window list and type byobu attach -t 0
starting from the
second time of opening Byobu.
See Use Tmux for Previewing Posts in this blog for details. ↩
See Key mapping collision between vim-navigation and vim-latex by Chris Choy for details. ↩
See Proper Format for Byobu’s windows.tmux? on Super User. ↩
Vim-$\rm \LaTeX$ enables users to jump to a syntax error quickly. To show you how, I use a GIF “animation”, instead of a video, so that the file size is much smaller.
Explanation:
Error message: The equation*
environment is “undefined”.
Cause of error: I forget to include the amsmath
package in the
preamble.
j
to move the
cursor down in the quickfix window by one line, and the window below
showing the log file automatically scrolled down.k
to go up one
line, so the situation goes back to Figure 1.<Enter>
to jump
to the “error location”. (line 6)<C-w>j
to go
back to the quickfix window, and the situation goes back to Figure 1
again.j
again, and
the situation goes back to Figure 2.<Enter>
again
to jump to another “error location”.P.S. As I’ve said in my “About” page, I mainly write in Markdown now, unless a teacher want me to submit homework with specific formatting requirements like 1-inch margin, 1.5 line spacing, etc. As you can see from the footer of this blog, this post is also written in Markdown.
]]>Go for FLOSS! Go for freedom!
Original settings for Ado* Read*: let
g:Tex_ViewRuleComplete_dvi='C:/.../AcroRd32'
in _vimrc
(No extension
name)
How to change Vim-$\rm \LaTeX$'s setting of \lv
?
Set g:Tex_ViewRuleComplete_dvi='C:/.../SumatraPDF'
in _vimrc
(No
effect)
Set g:Tex_ViewRule_dvi='C:/.../SumatraPDF'
and disable
g:Tex_ViewRuleComplete_dvi
in _vimrc
(No effect)
Set g:Tex_ViewRule_pdf='C:/.../SumatraPDF'
and keep
g:Tex_ViewRuleComplete_dvi='C:/.../AcroRd32'
in _vimrc
(Ado*
Read* launched instead)
…
Set g:Tex_ViewRule_pdf='C:/.../SumatraPDF'
and disable
g:Tex_ViewRuleComplete_dvi='C:/.../AcroRd32'
in _vimrc
(No effect)
PATH
environment variable. (You can change it for Vim
runtime and keep the original one in other programs. See
my newer post for details.)g:Tex_ViewRule_pdf='SumatraPDF'
g:Tex_ViewRuleComplete_dvi
in _vimrc
This shows to good things of free and open source software:
From the Vim plugins on the GitHub, you’ll discover even more good points of FLOSS:
and more …
The more the FLOSS developers, the better our free software!
]]>