Showing posts with label texlive. Show all posts
Showing posts with label texlive. Show all posts

09 May 2014

574. Texmaker and texlive on windows xp

There are two ways of dealing with latex on windows -- either using native packages or via cygwin. Here's the  native approach, which I tested in a virtual machine with Windows XP SP2

1. Install texlive

Go to and download

Run the file. You'll now be taken through the installation of texlive. Note that the full installation is ca 3.7 Gb and it will take a few hours to download and install. On the other hand, space is cheap and most people (in academia) don't pay for bandwidth, so it's not a bad idea to do the full install.

Anyway, here are a few screenshots of the installation process:

It's a good idea to change the mirror to speed up the download

Uncheck TexWorks since we'll be installing TexMaker

This step can take many hours

Finally done.

2. Install texmaker

Go to and download

The same file will work on XP, Vista and 8 (and presumably 7, which is more or less a patched version of Vista) and it will work on both 32 and 64 bit systems.

Install texmaker.

3. Configure  texmaker
Start texmaker

Go to Options/Configure Texmaker.

Under Commands you can select to use an external pdf viewer. Note that you will need to make sure that the path is correct -- in my case it was pointing to adobe reader 11, whereas I had adobe reader 9 installed. Easy enough to change, but you need to do it manually. The embedded/internal pdf viewer works ok, but distorts the text and figures somewhat (everything got a bit squashed)
Choose internal or external pdf viewer. Make sure the path is correct
Under Quick Build you can tick Latex+Bib(la)tex+Latex(x2)+dvips+ps2pdf+View pdf. NOTE: if you do this you won't be able to compile any file which hasn't got a \cite command and a mathing .bib file.

Alternatively, pick latex + dvips + ps2pdf + View pdf.

Quick Build -- pick the one with bibtex in it
Under Editor you can disable code completion (which can get annoying at times):

You can now load a tex file and hit F1 to compile it:

Quick test example

0. Create a folder called e.g. testtex
1. Download UCSD.eps from here:

Put it in the testtex folder.

2. Create the following anothertest.bib file in either texmaker or notepad:
  AUTHOR = {Placeholder, A},
  TITLE = {Comprehensive title},
  YEAR = 2014,
  JOURNAL = {J. Comp. Chem.},
  VOLUME ={45},
  PAGES = {100-101}
Put it in the testtex folder.

3. Create a new tex file in texmaker:

Make sure to tick graphicx

Basic tex file
Save to your testtex folder.

4. Edit your tex file as shown below::

\title{This is a test}


\section{The test}
This is a simple test which consists of inserting a figure and adding a reference via bibtex. You can download the logo from \url{}. Put the UCSD.eps file in the same directory as your .tex file.
 \caption{UC San Diego logo.}

Here's a citation.\cite{2014:example}

5. Compile.
If you set up your F1 as shown above (i.e. with bibtex support), then all you need to do is hit F1. Otherwise, if you used the alternative setup, do F2 (latex), F11 (bibtex), F2 (latex), F11 (bibtex), F1 (compile and view).

10 July 2012

205. Debian, TeXLive and style files: making lecture slides

Because I keep forgetting...(my blog serves as a public notebook). I don't make any presumptions about this being terribly new or relevant to a lot of people.

This post expanded into something quite different from what was indicated by the title:

Here's the short version:
kpsewhich -var-value=TEXMFHOME
ls $HOME/texmf
ls: cannot access /home/me/texmf: No such file or directory
mkdir ~/texmf/tex/latex -p

Copy your style files e.g.
cp lecturestyles/ -R ~/texmf/tex/latex

(sudo) texhash

And here goes the long version:

I hate powerpoint presentations --- even if they are made with latex (time to make it a generic trademark?) but the university I'm working at considers blackboards too old-fashioned. Apparently the maths and physics departments are still fighting the good fight, but my department has rolled over. Why do we let people who don't teach decide how we do things? Anyway...

For my lecturs, slides, seminar talks etc. I'm using a fairly heavily edited version of this
for making slides. It's served me well for giving seminar talks etc. I'm currently putting together a new course* and it's now becoming more important than ever to make sure I organise my material already from the outset.

So, a few things to do:
1. Organise everything neatly in folders:




Beware: when you include images in silicon.tex but call silicon.tex via main.tex, the paths are relative to main.tex, i.e. it's not ../images/aluminium/ore.eps but images/aluminium/ore.eps.

2. Finally move the style files from the local folder (i.e. where the tex file is) to the destination indicated by TEXMFHOME variable:

kpsewhich -var-value=TEXMFHOME
ls $HOME/texmf
ls: cannot access /home/me/texmf: No such file or directory
mkdir ~/texmf/tex/latex -p

Copy your style files e.g.
cp lecturestyles/ -R ~/texmf/tex/latex/

(sudo) texhash 

3. Make liberal use of \include{} in latex
Basically -- you have a document with the preamble

 \def\biz{\begin{itemize}[<+-| alert@+>]}
 \def\ben{\begin{enumerate}[<+-| alert@+>]}

\title{Chemistry 3456}


And then you create individual files for each lecture or topic e.g. silicon.tex:

\title{Silicon: spines, shells and minerals}
 \centerline{Department of Chemistry}

Today's lecture will cover:
\item Bouncy balls
\item Froth reductors

without preambles or anything of that sort.

It's still a bit annoying that you can't set the location of the aux, nav, log etc. files in each .tex document since the clutter offends my eyes. But hey, there's a limit even to my grumpiness.

4. \usepackage{}
Try looking for chemistry related packages which are installed on your system
find /usr/share/texlive/texmf-dist/tex/latex/ -name "*.sty"|grep [cC]hem

The ones which show up on my system are:
achemso, mychemistry, chemstyle, chemcompounds, mhchem, chemmacros, chemarrow and chemfig

mhchem is most likely the most useful one:
You can either do
\ce{OH-}+\ce{[B(OH)3} $\rightarrow$ \ce{[B(OH)4-}or more elegantly:\begin{reaction}
OH- + B(OH)3 -> B(OH)4-
SIunits are good too:
The bond length is 1.1 \angstrom{} at 298\kelvin{} (25 \celsius{})
Chemfig looks very promising for a 2D chemistry drawing package and uses tikz, but it has a fairly steep learning curve (in the sense that you need to familiarise yourself with most use cases before you can do anything - it doesn't necessarily take very long):

draws ethane. The 2, 4, 6 are angles in multiples of 45 degrees. So, there are H at 90, 180 and 360  relative to the first carbon. 0 degrees is parallel to the horizontal, and angles increase as in a normal coordinate system (i.e. counter-clockwise).
In addition, you can do Lewis dot structures:
The 420 means bar to the left (0), top (2) and left (4). 260 means bar left, bottom and top. There's a lot to learn though...

Lastly, e.g.
draws benzene. The 6 indicates a hexagon and the -=-= the sequence of bonds.

5. Dia for flowcharts and cycles
I tried using tikz to make pretty, native flowcharts and cycling diagrammes, but it was too much work and too hard for lecture slides (I might revisit it for articles)
Instead, the dia package in debian make it easy to quickly make up .eps flowcharts

6. Use inkscape to turn png into eps
A lot of programmes can create eps files from raster formatted image files. However, most of them do a very poor job.

Instead I like using inkscape and have a .sh file for it:
inkscape --verb FileSave --verb FileClose --export-eps=$1.eps $1.png

7. BKChem for more difficult schemes
8. GDIS/povray for nice 3D structures.

9. MOdiagram for MO diagrams. Awesome BUT enabling labels leads to catastrophic failure:
"! Font LGR/cmss/m/n/12=gsmn1200 at 12.0pt not loadable: Metric (TFM) file not found."

You need to install cbfonts which is supposed to be included in texlive (I think). But it seems that some files are missing. Download from Assuming you downloaded in ~/Downloads.
mv ~/Downloads/ ~/tmp
cd ~/tmp
cd cbfonts/
sudo cp fonts/* -R /usr/share/texmf/fonts/ 

sudo update-updmap

sudo texhash && sudo updmap-sys
*to all my former lecturers: I am so, so, so truly sorry for not appreciating more how 1) much effort is involved in putting together a course (even a badly prepared one) and 2) as an undergraduate I didn't acknowledge that teaching isn't your main job.

25 May 2012

163. Long rant over LaTeX problems caused by my own stupidity:

25 May 2012.
I'm having problems turning dvi into ps
latex test.tex
works fine.
dvips test.dvi
however gives
This is dvips(k) 5.991 Copyright 2011 Radical Eye Software ( dvips: ! Couldn't find header file: Process exited with error(s)
Diagnosis: PEBKAC
I was being a bloody idiot.
cat ~/.bashrc|grep TEX
export TEXINPUTS=/usr/share/texmf/tex/latex/prosper/prosper.cls:$TEXINPUTS
export TEXMFMAIN=/usr/share/texmf/

Once I commented those lines out and did
export TEXINPUTS=""
export TEXMFMAIN=""

everything was fine.

I wasted 1h30 min of prime working time on THIS. Anyway, I'm putting it all up here in case someone is having a similar problem. The moral of the story is:
always begin by checking your ~/.bashrc, ~/.cshrc and ~/.profile.

The other reason for posting it online is because the troubleshooting steps may be useful to have in the future.

gave nothing

/usr/share/texlive/texmf/dvips/base/ /usr/share/texlive/texmf-dist/dvips/gastex/

sudo texconfig
sudo mktexlsr
sudo texhash
helped (they pretty much do the same thing).

dpkg -S
texlive-science: /usr/share/texlive/texmf-dist/dvips/gastex/ texlive-base: /usr/share/texlive/texmf/dvips/base/

show dpkg is aware of the files.
kpsewhich -path /usr/share/texlive/texmf/dvips/base
obviously works.
dvips -d 2 draft_1.dvi
This is dvips(k) 5.991 Copyright 2011 Radical Eye Software ( input file draft_1.dvi output file swmem 180000 kdebug:Search path for PostScript header files (from texmf.cnf) kdebug: = .:/usr/share/texlive/texmf/dvips/base//dvips//:/usr/share/texlive/texmf/dvips/base//fonts/enc//:/usr/share/texlive/texmf/dvips/base//fonts/type1//:/usr/share/texlive/texmf/dvips/base//fonts/type42//:/usr/share/texlive/texmf/dvips/base//fonts/type3// kdebug: before expansion = .:$TEXMF/{dvips,fonts/{enc,type1,type42,type3}}// kdebug: application override path = (none) kdebug: application config file path = (none) kdebug: texmf.cnf path = .:$TEXMF/{dvips,fonts/{enc,type1,type42,type3}}// kdebug: compile-time path = /nonesuch kdebug: environment variables = TEXPSHEADERS PSHEADERS [..] dvips: ! Couldn't find header file:
export TEXMF=/usr/share/texlive/texmf
solves the problem, but gives this instead:
tex.dvips: Can't open font metric file cmr10.tfm dvips: I will use cmr10.tfm instead, so expect bad output. dvips: ! I can't find cmr10.tfm; please reinstall me with proper paths
locate cmr10.tfm
export TEXMF=$TEXMF:/usr/share/texlive/texmf-dist/fonts/tfm/public/cm
and we're back to
dvips: ! Couldn't find header file:
sudo dpkg-reconfigure texlive-base
didn't do anything for me.
aptitude search texlive|grep ^i|gawk '{print $2,$3}>texlive.list
I then edited texlive.list and remove all the initial A on the relevant rows.

sudo apt-get purge texlive

followed by
cat texlive.list|xargs >list
I the took the list there
sudo apt-get install `cat list`
which did
sudo apt-get install feynmf latex-beamer latex-xcolor pgf prosper texlive texlive-base texlive-bibtex-extra texlive-binaries texlive-common texlive-doc-base texlive-extra-utils texlive-font-utils texlive-fonts-recommended texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base texlive-latex-base-doc texlive-latex-extra texlive-latex-extra-doc texlive-latex-recommended texlive-latex-recommended-doc texlive-luatex texlive-metapost texlive-metapost-doc texlive-pictures texlive-pictures-doc texlive-pstricks texlive-pstricks-doc texlive-publishers texlive-publishers-doc texlive-science texlive-science-doc texpower tipa

It still doesn't [censored] work!

It's the same shit with

dvipdfm draft_1.dvi
** WARNING ** Could not open config file "dvipdfmx.cfg". draft_1.dvi -> draft_1.pdf [1] 22057 bytes written

locate dvipdfmx.cfg
/usr/share/texlive/texmf/dvipdfmx/dvipdfmx.cfg /usr/share/texlive/texmf-dist/tex/generic/pstricks/config/xdvipdfmx.cfg
sudo texhash and sudo texconfig do nothing.
cat /usr/share/texlive/texmf/ls-R|egrep "|dvipdfmx.cfg"
dvipdfmx.cfg dvipdfmx.cfg.ucf-dist
So what the bloody hell is the effing problem?
locate ls-R
/usr/share/texlive/texmf/ls-R /usr/share/texlive/texmf-dist/ls-R /usr/share/texmf/ls-R /var/lib/texmf/ls-R /var/lib/texmf/ls-R-TEXLIVE /var/lib/texmf/ls-R-TEXLIVEDIST /var/lib/texmf/ls-R-TEXLIVEMAIN /var/lib/texmf/ls-R-TEXMFMAIN
So which ones have in them?
/usr/share/texlive/texmf/ls-R -- yes /usr/share/texlive/texmf-dist/ls-R -- no /usr/share/texmf/ls-R -- no /var/lib/texmf/ls-R -- no /var/lib/texmf/ls-R-TEXLIVE -- yes /var/lib/texmf/ls-R-TEXLIVEDIST -- no /var/lib/texmf/ls-R-TEXLIVEMAIN -- yes/var/lib/texmf/ls-R-TEXMFMAIN -- no