Showing posts with label Latex. Show all posts
Showing posts with label Latex. Show all posts

Friday, March 4, 2016

Bibdesk annotations in TeX preview

If you would like to display the annotations you do in bibdesk in the TeX preview then you can do so as follows.

The annotations you make are kept in a bibtex field called "Annote".

We need a bibtex style file (bst) that supports this annote field.
You can copy paste the plainannotate.bst file at the end of this post.

Next, create the following directory
~/Library/texmf/bibtex/bst
and put the style file there.

Now from Bibdesk set the preferences as follows


That is it



Thursday, June 19, 2014

pbibtex Japanese processing

If you are using pbibtex in TexShop and have Japanese bib file encoded in sjis, then you need to specify the kanji code as sjis in order to properly format the Japanese bibtext entries. This can be done either by command line as
$ pbibtex projname -kanji=sjis
or by the TexShop Preferences --> Engine dialog under default bibtex engine specification by setting
pbibtex -kanji=sjis

Saturday, June 2, 2012

Ordering among citations in a multiple citation in Bibtex

It is possible to arrange multiple references within the same brackets by doing \cite{paper1,paper2} instead of \cite{paper1}\cite{paper2}. The former will produce for example [1,2] and the latter will produce [1][2]. The former approach is considered better.

However, sometimes the ordering among the citations within a multiple citation might not come right. For example, \cite{paper1,paper2} might produce [2,1] instead of [1,2]. Here again, it is considered better to order citations in a multiple citation according to the order they appear in the references list. To make sure they are ordered as such add \usepackage{cite} in the preamble of your latex source file.

Monday, September 19, 2011

TexShop coloring

From version 3.06 (Lion) it is possible to have different background and foreground colors in TexShop.

You can select the background colors from Preference dialog box. However, other colors must be
specified at command line.

defaults write foreground_R 1
default write foreground_B 1
default write foreground_G 1
will make the font color to white.

The background color can be changed from TexShop Preferences window.

defaults write TexShop commandblue 1
defaults write TexShop commandred 0
defaults write TexShop commandgreen 1
will make the command color to cyan.

To change the cursor color to white do
defaults write TexShop insertionpoint_R 1
defaults write TexShop insertionpoint_G 1
defaults write TexShop insertionpoint_B 1

defaults write TexShop commentred 0
defaults write TexShop commentblue 0
defaults write TexShop commentgreen 1
will make the comment color to lime green.

These are RGB decimal color codes. To obtain those values divide RGB colors from 255.
Here is a list of RGB colors.

TexShop documentation where these color preferences are mentioned can be seen here.

Thursday, April 7, 2011

TexShop MacTex US letter PDFs

By default when you install MacTex and use TexShop for writing and compiling latex you will get PDFs with page size A4. This is all fine for most cases but some conferences require you to submit in US letter format and do not accept A4. This is where the problem begins and all sorts of solutions are proposed on the Web and most require you changing your entire latex configuration to produce US letter size (at least temporary until you revert those changes back to A4). Naturally, I tried those solutions (giving up the hope of finding a solution that can do this paper size change per document basis as it should be and not for the entire latex system) but failed. So I adopted the following command line approach and it works like a charm even without having to modify a single configuration file.

So I thought I would share this solution with the rest of the world.


  1. First things first. Write your document using TexShop (producing A4 size PDFs as it is done by default) and concentrate on the content of the document. At the end of the day that is what matters most. :-)
  2. Now open a Terminal and type the following command to produce a dvi file.
    /usr/texbin/latex mypaper.tex
    Of course, the path to latex (/usr/texbin/latex) depends on your MacTex installation and this is the default installation path. This will produce the 'mypaper.dvi' file.
  3. Now we can convert this dvi to a PDF with suitable page size (US letter in this case) using the following command.
    /usr/texbin/dvipdfm -p letter mypaper.dvi
    This command will produce the 'mypaper.pdf' with the US letter paper size. By the way the dimensions for those two sizes are as follows.
    US letter: 215.9mm x 279.4mm
    A4: 210mm x 297mm source is Wikipedia.
  4. This does the trick! Of course you can also produce a postscript (ps) file if you want to. (Some publishers ask for this one as well.)
    /usr/texbin/dvips -t letter mypaper.dvi -o mypaper.pdf
    Another option to generate a pdf is from this ps file. You can use Acrobat distiller for this purpose. But then why would need to do that when you can do that directly using dvipdfm from the dvi file.
Well, at the end of the day there is no alternative to the power of the command line.... :-)

Additional Note
If you are using pdflatex and do not want to go through the above tex->dvi->pdf routine OR you are compiling with sig-alternate class in the ACM template, creating US letter size PDFs might be difficult.
A good reference is here.
The solution proposed in that reference is to put the following page size modifying lines in the preamble of the document (where you would put \usepackage commands and is prior to \begin{document} is called the preamble in a tex document.).

\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}



This indeed works!

Sunday, January 30, 2011

How to change Figure and Table captions in LaTex

Usually figures and tables in LaTex get captions such as Figure 1 or Table 1. We can change these to other names as follows.

\renewcommand{\figurename}{Fig.}

OR to Japanese captions such as (with jarticle class)


¥renewcommand{¥figurename}{図}
¥renewcommand{¥tablename}{表}

Sunday, June 20, 2010

TexShop

In TexShop to autocomplete a bibliography reference or a label just type some part of the reference and press F5 to get a list of candidates.

Sunday, October 26, 2008

Double Spacing

To add double-spaced line in Latex, do the following:

\usepackage{setspace}
\doublespacing

Friday, July 11, 2008

Setting up WinShell and dviout with pLatex

Install pLatex using the installer at;
http://www.ms.u-tokyo.ac.jp/~abenori/mycreate/

install ghost script, ghost view and dviout

install winshell
http://www.winshell.org/modules/ws_download/

configuration in winshell
options->program calls
1. Latex
C:\pTex\bin\platex.exe
cmdline: -src-specials -interaction=nonstopmode "%s.tex"
[-src "%s.tex" worked for me]

2. bibtex
C:\pTex\bin\jbibtex.exe
cmdline: "%s"

3. dviview
C:\pTex\dviout\dviout.exe
cmdline:-1 %s.dvi "# %l '%c.tex'"

4. dvips
C:\pTex\bin\dvipsk.exe
cmdline:-D600 "%s.dvi"

set font; ms gothic size 14 script Japanese encoding sjis

set colors in syntax-colors

In dviout set the following settings;
option->set up parameters->common
src: C:\Program Files\WinShell\WinShell.exe^s-c "%s" -l %d

This will jump to the position in winsell editior when you double click on a word in the dvi file

check, options->continuous review
to stop opening dviout window everytime you run dviout from winsell.
Moreover, it will instantly show any changes that you have made to tex file when you compile it.

LaTex PDF Generation from DVI

To create a USLetter size pdf from dvi do,
dvipdfm -p letter mypaper.dvi

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1