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
-
In order to replace a text in a set of files
:args <list of files> :argdo %s/search/replace/ |w -
Adding simple syntax highlighting on the fly
Using the syntax command, syntax rules can be added to vim
to improve readability of the file. While there are many
options available (see :h syntax), I found thesyntaxoption fit for my use. Say we want to turn every
region
line starting with**into a different color. We can do
that using command:syntax region Nontext start="^\*\*" end="$"The above command says that any line starting with
**
should be displayed in the color pattern as defined by the
group-nameNontext. A syntax region description like
above needs to specify a start pattern (a regex) and an
end pattern (another regex). In the example above the
start pattern is^**, i.e., any line starting with**
and the end pattern is$, i.e., end of line. (since*
needs to be escaped in vim, a regex^**becomes^\*\*
in the above example). Vim has some standard color names
define that can be used to define the appearance of
selected region. Try:hito list all the group-name and
how they would look on the current terminal. This example
uses on of the standard group-name define asNontext.Recently, I had to submit some reviews and I choose to
submit it using a text file (reviews.txt) provided to
me. The file has a large number of section in the
following format:@paper: xyz @type: paper \*\* SOME TITLE: @T1 <replace with one or more lines of review text> @@ \*\* SOME TITLE: @T2 <replace with one or more lines of review text> @@In order to quickly identify places that I need to add
text, I added the following lines to a file (hi.vim)syntax region Nontext start="^\*\*" end="$" syntax region Question start="^@" end="$" syntax region Diffchange start="^-" end="$"and edited by file by opening it as
gvim -S hi.vim review.txtTry it and the usefulness of these line will be apparent.
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 seehttp://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>
-
Online Lectures, Talks, etc.
-
Video Lectures
Thanks Abhishek -
Research Channel
Thanks Nilesh - Tech Talks at Google
What Google Needs
Google Search
- Ability to search an image similar to a given image.
- Today, we enter text and expect Google to list all the sites containing that text. A natural extension to this would be to upload an image and get all websites having a similar image. Applications could range from (a) finding all websites that use a trademark image to (b) Finding details about a personality (place, paintings, etc.) by her/his (its) picture. (I recently (Feb. 2009) attended a talk by Kilian Weinberger from Yahoo Research on machine learning techniques to accomplish it.)
- Purging invalid links and associated cache
- An option, say “Check link validation”, in Google search to let users inform Google that a site is no more valid. Google says it’s crawler would detect it but I have seen invalid links (and its cached copy) on Google for months.
(Note: Many, including Google, have compiled features list, but I have compiled here the ones I didn’t find on (at least) the ones I browsed.)
Travel Tips
Buying Tickets
A list of sites to search for an air ticket
- Farecast now Bing Travel
- CheapTickets
- FareCompare
- Kayak
- OAG
- FareCompare
- AirlineConsolidator
- cFares
- TripAdvisor
Includes a fee estimator for baggage, on-board meals, etc.
While waiting for the flight
- Price Check
- Yapta
After purchasing a ticket mail it to flights@yapta.com and yapta
will tell you whenever the prices go down to claim a credit.
- Yapta
- Seat Selection and Trip Planning
- SeatGuru
Get reviews to pick us the best available seats. - checkmein
Paid service, currently restricted to few airlines, that checks in
as per user’s preferences when online check in begins. - TripIt
Mail your complete itinerary to Tripit which compiles it in a
single file with addition information that you might require
during the trip.
- SeatGuru
- Flight Status
- FlightStatus
- Flight Delay Information
- Flight Aware
- FlightCaster
Predicts flight delays.
- Miscellaneous
- FlyingFees
Find out about baggage policies and fees for various airlines.
- FlyingFees
Refunds
- MissRefund
Get something back even from a non-refundable ticket. Read more - Payoffs on overbooked flights
India Specific
Travel Agent
Domestic (India)
Recommendations for Elevator Design
Feature recommendations
- The open door switch should be color coded (so that next time we
want to help someone we can find the switch to press before it’s too
late.) - A switch to deselect a floor if one accidentally selected it.
Next Generation Travel Sites
Current Solution
You plan a trip. You break it down into air travels, hotels, etc. for
each city and search the best deals for each of one them.
Better Solution
Instead you build a complete itinerary of your trip including when you
would like to visit a city, places you would visit in the city, a radius
within which you would like to stay (or this could be calculated
optimally from other data), hotel preferences, duration of the stay,
etc. The site then finds the best deal for the complete trip.