LaTeX, Lyx, MetaUML & Zotero on Ubuntu
Lyx is an open-source word processor built on top of LaTeX and Zotero is modern, open-source bibliography management package with "cloud" features. MetaUML is a system for creating UML diagrams in LaTeX (it's frankly pretty painful to use but it does produce professional looking results). This post is where I keep my notes about installing and configuring LaTeX, Lyx and Zotero on my Ubuntu system at Imperial (where I do not have root access).
Installation
Install TeX Live 2011
First, download and install TeX Live 2011 (which includes LaTeX). Ubuntu 11.04 ships with TeX Live 2009 which lacks several features I need (specifically for handling graphics and graphs).
TEXDIR install directory by pressing D on the first screen of the TeX Live installation program to a directory to which you have write permissions. I use /data/usr/local/texlive/2011 as my TEXDIR on my Imperial machine.export PATH="$PATH:/install/directory" to ~/.profile. If you're using csh then also add setenv PATH "$PATH:/install/directory" to your ~/.cshrc. For example, I use csh so I add setenv PATH "$PATH:/data/usr/local/texlive/2011/bin/x86_64-linux" to my ~/.cshrc AND I also add export PATH=$PATH:/data/usr/local/texlive/2011/bin/x86_64-linux to my ~/.profile file. If I modify ~/.cshrc only then starting Lyx using the ALT-F2 does not load with the correct path settings (the path in which I installed TeX Live 2011 and the path with the latest version of Lyx must come before the other path variables).Install GNU aspell
If you have root permissions then just do sudo apt-get install libaspell-dev. If you do not have root permissions then:
- Download source from http://aspell.net/
./configure --prefix=/homes/dk3810/binaries && make -j9 && make install
Install Lyx 2.0.2
Now download and install the latest version of Lyx.
- I have to install the binaries to a directory within my home directory because I do not have write access to /usr/bin so I run:
./configure --prefix=/homes/dk3810/binaries --with-extra-prefix=/homes/dk3810/binaries make -j8(replace "8" with the number of CPU cores available)make install- If you installed in a non-standard directory then add that directory to your path.
Install Zotero
Download and install from Zotero's download page. I'm using 3.0 beta.
Install MetaUML
(after installing TeXlive 2011)
In the install file, change the directory TEXMF_HOME=/usr/share/texmf to /usr/share/texmf-texlive (or whatever your TeX Live install directory is).
Configuration
Lyx configuration
- Document > Settings:
- Bibliography
- Processor: bibtex8 (see Lyx manual sec 6.5)
- PDF Properties
- Enable “Use hyperref support”
- Add a title and Author
- In the “Hyperlinks” tab:
- check “no frames around links”
- check “color links”
- enter
urlcolor=BlueViolet, citecolor=CadetBlue,linkcolor=blackinto Additional Options
- If using Document Class “book (KOMA-Script) then add
,usenames,dvipsnames(with the leading comma) to “Document Class > Class options: custom” else add\usepackage[usenames,dvipsnames]{color}to LateX Preamble. See LaTeX WikiBook for more info on hyperlinks and colours. - Listings > add
commentstyle={\color{blue}}(or DarkOrchid) into the bottom box - Page Layout > A4
- Language
- English UK
- Encoding > “Unicode (utf8)”
- Output > Default Output Format > PDF (pdflatex)
- Bibliography
- Tools > Preferences:
- Output > Default Paper Size A4
- Output > LaTeX > Uncheck “User LaTeX font encoding”
- Editing > Shortcuts:
- Change bind file to emacs
- Search for "view". Modify
buffer-view ps. Delete thepsso the command isbuffer-viewand change the key binding toCtrl+Shift+X C. - Search for "update". Modify
buffer-update ps. Delete thepsso the command isbuffer-updateand change the key binding toCtrl+X C. - Search for "buffer-write" (the command to save). Change keybinding to
Ctrl+X S
- Tell Lyx to pass the
-shell-escapeparameter topdflatex. Go to Tools > Preferences > File Handling. Select "LaTeX (pdflatex) -> PDF (pdflatex)". Modify the "Converted:" field so it reads:pdflatex -shell-escape $$i. Click "Modify" and "Save". this forum thread gives more details.
LaTeX preamble:
\usepackage{a4wide}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage[left=2.5cm,right=2cm,top=2cm,bottom=2cm]{geometry}
% for dot2tex
\usepackage{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usepackage[margin=10pt,font=small,labelfont=bf]{caption}
\usepackage{textcomp}
% For MetaUML:
% The following is needed in order to make the code compatible
% with both latex /dvips and pdflatex.
\DeclareGraphicsRule{*}{mps}{*}{}
Zotero configuration
Preferences > Export > check “display character encoding on export” and select “UTF8” in the drop -down list.
To enable URLs in references
Download and install urlbst. Then:
cp urlbst ~/binaries/bin
cp *.bst /data/usr/local/texlive/texmf-local/bibtex/bst/local/
texhash
(you'll have to use the correct directories for your setup).
To stop duplicated URLs in bibliography
Edit /home/USER/.mozilla/firefox/HEX.default/zotero/translators/BibTeX.js
Comment out this code around line 2099:
if(item.itemType == "webpage") {
writeField("howpublished", item.url);
}
To change the colour of the links (not requried if using Lyx)
\usepackage{hyperref} % required to get URLs into references
\hypersetup{citecolor=blue,urlcolor=blue}
http://wiki.lyx.org/BibTeX/Tips
Use
Bibliography
- Export your bibliography from Zotero with Actions > Export Library > Format=BibTeX (do not export files). Save to file
- In Lyx: Insert > List/TOC > BibTeX Bibliography. Press "Add..." and then "Browse" and select your .bib database file.
- Now add individual references to your text with Insert > Citation.
Add new comment