Just read from an article here regarding Vel’s effort on putting template on a single page. You can check out Vel’s initiative from this page.
TeX4ht Options
CV Radhakrishnan (CVR) has posted a list of TeX4ht options, the most comprehensive I have seen yet.
TeX4ht is a very powerful piece of software for converting LaTeX to other formats, such as (X)HTML and ODT. Unfortunately, the documentation was never truly complete, and the inner workings of the system can be hard to grasp and understand. The original creator, Eitan Gurari passed on unexpectedly in 2009. CVR and Karl Berry has since taken over the maintenance of TeX4ht.
As a side note, if you have an existing LaTeX document that you need to convert to other formats, TeX4ht is the most robust system that I have come across, i.e. it works with almost any LaTeX packages that are used in your document. (See this link for other LaTeX-to-whatever conversion tools.)
On the other hand, if you’re just starting to write your document from scratch, with a view to exporting to different output formats later, you might be better off using DocBook or pandoc instead. I personally prefer the markdown syntax in pandoc and exporting to LaTeX later for further editing.
Reaction to Bad Kerning
Working collaboratively.. which one you prefer?
Converting an EndNote Database to BibTeX
During a recent LaTeX introductory workshop, many participants said that they’re very much looking forward to using LaTeX for their future writings, but mentioned that there didn’nt seem to be an obvious way of porting their existing EndNote bibliography libarary into BibTeX format.
EndNote does have an “Export BibTeX” filter, but it doesn’t seem to generate satisfactory BibTeX files. After some googling, I found Bevan Weir’s customised export filter, which does a much better job than EndNote’s default. I modified his filter file a little bit more, and was able to convert an EndNote bibliography library to BibTeX with the following steps.
I tested this with EndNote X5 on the Mac, with JabRef 2.7, but they should also work with Windows versions. %ENDNOTE%
refers to the path where EndNote is installed on your system.
- Put
BibTeX_Export_LLT.ens
(download) in%ENDNOTE%/Styles/
. - Start EndNotes, and load your library.
- Make sure the new style is listed:
Edit > Output Styles > Open Style Manager
Make sureBibTeX_Export_LLT
is checked. - File > Export
Make sure Save File as Type is set to Text Only, and Output Style is set toBibTeX_Export_LLT
. - Save your file and check that it has a
.bib
extension. - Open the exported
.bib
in JabRef. There will be a whole bunch of errors about corrupted or empty BibTeX keys; don’t worry. Just click OK. -
Ctrl+A
to select all the BibTeX entreis, Tools > Autogenerate BibTeX keys. - Check through the BibTeX entries, especially those highlighted red, to check and correct any crucial information loss.
And hopefully the converted bibliography file is now usable enough.
‘Funny Drawings’ with pst-fun
I learned of the pst-fun package today from an answer at TeX.SX, which provides convenience commands for some ‘fun’ drawings in PStricks. Time for some quick fun then!
\usepackage{pst-fun}
\begin{document}
\begin{pspicture}(-1, -2)(13,10)
\psParrot{.8}
\rput (2.5,7) {\psBird[Branch]}
\rput (10,-1.5) {\psscalebox{-1 1}{\psKangaroo[fillcolor=red!30!yellow]{5.75}}}
\rput {-50} (6,0) {\psBird}
\end{pspicture}
\end{document}
Compile with latex, or xelatex if you want a PDF output. And the output looks like this:
…and I really should get back to work now!
LaTeX Training & Consultancy
I’ve recently started offering LaTeX training and consultancy services as a freelancer (between writing up my thesis and parenting). So if you happen to be sourcing for a trainer, or need a consultant for LaTeX-related typesetting or design, feel free to have a look at my webpage and contact me.
Thanks to the other blog authors for letting me post this here. I’m doing this T&C as a personal attempt, so please address your gripes just to me (Lian Tze) if you have any issues with my services, and not to the other authors here.
Creating an Online Academic Portfolio with LaTeX and TeX4ht
This was originally asked on TeX.SX, the requirements being:
Any one know of a good script to turn a bibtex file into a nice academic portfolio that:
- links to electronic versions where known (from url or doi)
- works with local files (e.g. with bibdesk’s format or otherwise)
- automatically creates a thumbnail of the first page
- and generally produces a polished web page suitable for showing off your work?
Well, I maintain my own online publication list by generating the HTML code from my BibTeX, using BibLaTeX, Biber and TeX4ht. So my answer to the above question was a quick modification of my own workflow, adding Ghostscript to the mix to generate thumbnail images of the papers. The output looks like this: (The publication lists can be split according to their types)
(BibLaTeX is a complete reimplementation of the bibliographic facilities provided by LaTeX in conjunction with BibTeX. It’s very flexible, and many find it easier to deal with compared to the BST language. Biber is the replacement of the BibTeX binary, for users of BibLaTeX.)
The source codes can be downloaded here as a .zip file. Further elaborations follow.
The Bibliography File
Back to the task at hand. First we have the BibTeX file, the content of which is pretty much the norm, except that I used the custom BibLaTeX field to hold the local PDF file name. My publications.bib contains entries like:
author = {Lim, Lian Tze and Ranaivo-Malan\c{c}on, Bali and Tang, Enya Kong},
title = {Low Cost Construction of a Multilingual Lexicon from Bilingual Lists},
journal = {Polibits},
year = {2011},
volume = {43},
pages = {45–51},
url = {http://polibits.gelbukh.com/2011_43/43-06.htm},
usera = {LLT-polibits.pdf}
}
The LaTeX Source File
Next is the portfolio.tex file, in which I set up a hook at every bibliography item to include the first page of the file pointed to by usera. I’ve also added a bibmacro called string+hyperlink, to make the publication title link to the url or doi field if these are available, as shown in this answer.
\usepackage[backend=biber,bibstyle=authoryear,sorting=ydnt]{biblatex}
\usepackage{graphicx}
\bibliography{publications}
\usepackage{hyperref}
\ExecuteBibliographyOptions{doi=false,url=false}
\newbibmacro{string+hyperlink}[1]{%
\iffieldundef{url}{%
\iffieldundef{doi}{#1}{\href{http://dx.doi.org/\thefield{doi}}{#1}}}
{\href{\thefield{url}}{#1}}}
\DeclareFieldFormat*{title}{\usebibmacro{string+hyperlink}{#1}}
\newbibmacro{usera}{%
\iffieldundef{usera}{}{%
\savefield*{usera}{\filename}%
\usebibmacro{string+hyperlink}{\includegraphics[width=100pt]{\filename}}\\}%
}
\AtEveryBibitem{\usebibmacro{usera}}
\begin{document}
\section{My Academic Portfolio}
\nocite{*}
\printbibliography[title={Articles},type={article}]
\printbibliography[title={Conference Proceedings},type={inproceedings}]
\end{document}
TeX4ht Configuration File
I then set up a TeX4ht personal configuration file, called portfolio.cfg (included in the .zip file). It contains some simple CSS, and tells TeX4ht to convert the first page of the local PDFs into PNGs using ghostscript. (So yes you will need to have ghostscript installed for this to work.)
Generating the HTML
Right, now we can run the following commands:
$ biber portfolio
$ htlatex portfolio “portfolio”
And you should then get portfolio.html, which you can further embellish with more CSS. Well that was fun!
LaTeX in comic
from here
Mail-Merge Batch Generating Documents with datatool Package
If you aren’t aware of the possibility before this, you read the title right, it’s possible to do mail-merging in LaTeX with e.g. the versatile datatool package. This makes LaTeX quite a handy Swiss knife in a pinch.
The example scenario: you need to produce a batch of letters, name cards, or certificates really quickly. Let’s say certificates of appreciation for some long-serving employees. The recipients list has most probably been compiled by someone, as a spreadsheet like this:
Now all spreadsheet applications should be able to export the worksheet as a comma-separated values (CSV) plain text file, so we have namelist.csv with the following contents:
Abdul Ali,382473856,M,15
Francesca Joestar,461276432,F,10
Chan Ker Mei,463724631,F,5
Hikaru Yagami,154954739,M,10
The datatool package can then load namelist.csv as a simple database, which each line being a record, consisting of fields delimited by commas. By default, the field names are given by the first line of the .csv file. After assigning macros to the field names, we can then use the macros to insert ‘mail merge’ fields into a LaTeX document.
Here’s a quick example, using the wallpaper
package and an external image (image courtesy of fromoldbooks.org) for the decorative frame:
\documentclass[16pt]{scrartcl}
\usepackage[left=3cm,right=3cm,top=6cm,bottom=5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgschola}
\usepackage{fourier-orns}
\usepackage{graphicx}
\usepackage{wallpaper} % For background image frame
\usepackage{datatool}
% Load database ‘names’ from file ‘namelist.csv’
\DTLloaddb{names}{namelist.csv}
\begin{document}
\linespread{2}\selectfont
\pagestyle{empty}
% Set old-border.jpg as background image
\TileWallPaper{\paperwidth}{\paperheight}{old-border}
% For each record (line) in database ‘names’
% Assign field values by name to macros
\DTLforeach{names}
{\name=Name, \ID=ID, \gender=Gender, \yr={Years in Service}}{
{\centering
{\LARGE\bfseries Certificate of Appreciation}\par
{\LARGE\decofourleft\quad\decoone\quad\decofourright}\par
\vskip2em
We thank\par
% Insert ‘\name’ field
{\large\bfseries\MakeUppercase{\name}}\par
% Insert ‘\ID’ field
{\large (ID: \ID)}\par
for having been with\par
{\large XYZ Company}\par
% Insert ‘\yr’ field
{for \emph{\LARGE\yr} glorious years}\par
\vskip1em
% Test ‘\gender’ field and insert him/her, his/her
We commend \DTLifeq{\gender}{M}{him}{her} on
\DTLifeq{\gender}{M}{his}{her} excellent service.\par
}
\vfill
\hfill
\begin{minipage}{.4\textwidth}
Managing Director\par
\vskip1cm
\rule{8em}{.5pt}
\vskip-1em
(MD’s Name)\par
\end{minipage}
\pagebreak
}
\end{document}
And voilà, the output document has 4 pages, each containing the certificate for a recipient listed in namelist.csv.
Just for fun, here’re the same certifates using ornaments from the adforn font package. For more flamboyant ornaments, see the webomints fonts (installable via getnonfreescripts) or the psvectorian package.
The .tex source codes can be downloaded here.
datatool has many more macros for testing field values and even arithmetics. Other accompanying packages in the bundle, such as datapie, dataplot and databar, even lets you draw charts from .csv files via TikZ/PGF, so do check out the documentation.
Now I’m off to my holidays! Happy Chinese New Year to everyone, and may the Year of the Dragon brings only good tidings for you!