LaTeX Tips and Tricks
-
Interactively setting a variable
Add similar lines before
\documentclass\typeout{Please enter a value for var} \typein{\var}{var=} -
Including pages from other PDF documents
\usepackage{pdfpages} ........ \begin{document} \includepdfset{pages=-} \includepdf{cv.pdf} \includepdf{pubication1.pdf} \includepdf{pubication2.pdf}pdfpagesprovides lot of flexibility with selective
inclusion of pages, landscape mode, etc. -
Adding directories to package search path
(from Paul Jolly)% The trailing colon indicates the standard search % path should be appended to the user specified % TEXINPUT variable % Paths are ':' separated export TEXINPUTS=".:~/path/to/add:" export TEXINPUTS=".:~/path/to/add:/second/path/to/add:" % Trailing '/' for directories is optional export TEXINPUTS=".:~/path/to/add/:" % double trailing slash indicates this directory is % to be search recursively export TEXINPUTS=".:~/path/to/add//:" -
Input files with relative path
\inputand\includeare well known commands for
preparing larger documents from smaller files. However, if
these smaller sections of text are organized within a
directory with its own\input,\include,
\includegrapics, etc.,\inputwon’t work. For such
cases, LaTeX packageimportcan help.\usepackage{import} \import*{/play/act1/}{act.tex}On encountering
\input{scene1.tex}inact.tex, LaTeX
will now search forscene1.texin/play/act1/in addition to
the local directory -
Embedding fonts
Give
-dPDFSETTINGS=/prepressoption tops2pdfand
verify final output withpdffontsIn my case,
gnuplotwas the culprit that was not
embedding the fonts in figures. A more effective but
time-consuming way of correcting it is to specify tex
font file tognuplotas specified
here
or in more details here
Firefox Tips and Tricks
-
Editing textarea with your favorite editor
Very often one would prefer to write in a text area on the web using
ones favorite editor. For example, if you use Gmail you might like to have
the power of vim or emacs while composing mails. You can do that with
It’s All Text that displays an edit button that pops up your
favorite editor.-
Getting it to work with cygwin and vim
Create a file gvim.bat (in notepad) with the following text@echo off C:\cygwin\bin\run.exe -p /usr/X11R6/bin gvim -display 127.0.0.1:0.0 %*set editor to
C:\path_to_gvim.bat
-
-
Quickly accessing commonly used bookmarks
Use keyword bookmarking. Access any bookmark’s property ( Ctrl+Shift+B
and then the bookmark you are interested in or right click toolbar
bookmarks and then Properties) and set keyword for anycharacteror
sequence of characters. Now you can access this bookmark by pressing
Alt+D or Ctrl+L (to jump to the address bar)character[Enter].
Further customization with string substitution is possible. However,
using keyword with bookmarklet is still an issue.
More Information
Vim Tips and Tricks
-
Replacing text in a set of files
:args
:argdo %s/search/replace/ |w
SVN Tips and Tricks
-
Avoid typing long svn commands by defining appropriate function in your
.bashrcexport SVN_PATH="svn+ssh://path_to_svn/trunk" function sl () { svn ls ${SVN_PATH:?"SVN_PATH is not unset or empty"}/${1:?"Insufficient arguments"}}You can now list
trunk/projectsassl projects
Bash Tips and Tricks
-
Using
CDPATHcan save a lot of keystrokes.CDPATHis tocdwhat
PATHis to command completion. For example,export CDPATH=.:/home/joe/projects:will allow you to
cdinto a directory/home/joe/projects/wordpressfrom
any directory usingcd wordpress -
$'STRING'can help you print anything you wish. InSTRINGescape
'by\'$> echo $'foo\'bar' foo'bar -
Check variables as
${VAR_NAME?"VAR_NAME is not defined"} ${VAR_NAME:?"VAR_NAME is not defined or empty"} -
bash_completionallows you to go beyond command completion to listing
options available for the command. For example, on the latest version of
unbuntu (8.04) addsource /etc/bash_completionto your.bashrc. If
subversion is installed on your machine then$> svn <tab>will
list all possible options in svn as:add co -h log pedit proplist rm annotate commit help ls pget propset status blame copy --help merge plist pset switch cat cp import mkdir praise remove unlock checkout delete info move propdel rename update ci diff list mv propedit resolved --version cleanup export lock pdel propget revertIt supports many other commands. It’s auto-completion of
directories on a remote server forscpis really useful. -
Prevent annoying ssh disconnection by
alias ssh='ssh -o TCPKeepAlive=no -o ServerAliveInterval=15 -o ServerAliveCountMax=10'Alternatively, you can set these options in your
ssh_config($>) file. You can also try
locate ssh_configalias ssh='ssh -o TCPKeepAlive=yesBut it didn’t work for me. For further information and for
putty
settings see
http://drupal.star.bnl.gov/STAR/comp/sofi/facility-access/ssh-stable-con -
Bash has some lesser know command that provides exactly what you might
sometimes be looking for. A quick read ofinfo coreutilsis recommended.
Few such commands are-
prcan help you paginate or columnate text. For example,pr -2 <filename>will generate a two column output of the text with page boundaries
delimited with page headers and footers -
pasteto concatenate files vertically -
tacto concatenate files in reverse order.tac <filename>to print file
<filename>in reverse order -
Get a quick directory overview to a depth of
<n>tree -L <n> <dir_name>
-
leave a comment