<?xml version="1.0" encoding="iso-8859-1"?>
        <?xml-stylesheet type="text/css" href="http://www.miek.nl/blog/"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>Filed under: latex | Miek</title>
<atom:link href="http://www.miek.nl/blog/archives/latex/index-rss.xml" rel="self" type="application/rss+xml" />
<link>http://www.miek.nl/blog</link>
<description>Thoughts on (technical) stuff</description>
<dc:language>en-us</dc:language>
<dc:creator>Miek Gieben</dc:creator>
<dc:date>2012-02-04T04:15:11+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://www.miek.nl/blog/archives/2010/10/22/precise_float_placement/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2010/10/22/precise_float_placement/index.html</guid>
<title>Precise float placement</title>
<dc:date>2010-10-22T14:43:28+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex</dc:subject>
<description><![CDATA[<p>If you know LaTeX, you know that precise float placement (I want <em>this</em>
figure to positioned <em>right here</em>) is almost impossible. But what nobody
told you is that there exists a
<a href="http://www.ctan.org/tex-archive/macros/latex/contrib/float/">float</a>
package (only since 2001 - maybe even earlier). With this package you get a new placement modifier:
<code>[H]</code>, which means: "Put this damn figure right here!".</p>

<blockquote>
  <p>LateX users everywhere cheer.</p>
</blockquote>

<p>Specifics are described in the <code>pdf</code> in the package. Using it
on Ubuntu/Debian</p>

<pre><code>apt-get install texlive-latex-recommended texlive-latex-recommended-doc
evince /usr/share/doc/texlive-doc/latex/float/float.pdf
</code></pre>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2010/06/12/go_book_building/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2010/06/12/go_book_building/index.html</guid>
<title>Go Book Building</title>
<dc:date>2010-06-12T07:48:26+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex, go</dc:subject>
<description><![CDATA[<p>I'm still "writing a Go Book" which boils down to playing with 
<img class="inline-math" src="/gfx/mathtex.png" alt="LaTeX"/>, Go
and Vim. </p>

<p>Building the whole
<a href="http://www.miek.nl/cgi-bin/gitweb.cgi?p=gobook.git;a=summary">document</a>
might be a bit tricky, because of all the packages you may need.</p>

<p>Assuming you already installed TexLive on your system, you will
further need to <code>apt-get install</code>:</p>

<ul>
<li><code>texlive-xetex</code></li>
<li><code>ttf-droid</code> </li>
<li><code>latex-cjk-common</code></li>
<li><code>latex-cjk-japanese-wadalab</code></li>
<li><code>latex-cjk-xcjk</code></li>
<li><code>latex-xft-fonts</code></li>
<li><code>latex-fonts-recommended</code></li>
<li><code>ttf-sazanami-gothic</code></li>
<li><code>inkscape</code> (for <code>.svg</code> to <code>.pdf</code> conversion)</li>
</ul>

<p>Which should make it build. If not, please let me know.</p>

<p>Also, but completely unrelated</p>

<blockquote>
  <p><em>precise</em> float placing</p>

<p>... they said it was impossible</p>
</blockquote>

<p>Check out the <a href="http://www.ctan.org/tex-archive/macros/latex/contrib/float/">float
package</a>.
And it's <code>H</code> placement modifier. I'm <em>already</em> loving it!</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2010/06/02/remember_text_in_latex/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2010/06/02/remember_text_in_latex/index.html</guid>
<title>Remember text in LaTeX</title>
<dc:date>2010-06-02T11:16:09+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex</dc:subject>
<description><![CDATA[<p>After reading the Android Book from O'Reilly I saw some nice use
of bullets alongside source code which allowed for extra explanation to 
be given <em>after</em> the code. I thought only one thing:  I want to use that
too, but then in <img class="inline-math" src="/gfx/mathtex.png"
alt="LaTeX"/>.
After fiddling around for an evening it finally looked like this:</p>

<p><img src="http://www.miek.nl/gfx/2010/bullets.png" alt="Nice bullets in LaTeX"/></p>

<p>There are two ways you can do this. The easy way is to write a few
macros which create numbered bullets in the code and then use these
numbers <em>manually</em> after the code to add your explanation. There are
however problems with this approach; You need to manually keep the
numbers in sync and thus it distracts you from focussing on the text.</p>

<p>This is not the <img class="inline-math" src="/gfx/mathtex.png" alt="LaTeX"/> way.</p>

<p>In <img class="inline-math" src="/gfx/mathtex.png" alt="LaTeX"/>
you want your remark to be typed right away and remembered, so
that later it can just be rendered. This means <img class="inline-math"
src="/gfx/mathtex.png" alt="LaTeX"/> must somehow
<em>remember</em> your text. This is what I came up with.</p>

<pre><code>%% Code Remarks -- Miek Gieben
% define 2 commands
% \longremark[1] where you can say something about the code/whatever
% \showremarks - displays all remarks in a list after the code or where
%            you put the command
\usepackage{ifthen}
\usepackage{tikz}
</code></pre>

<p>Some counters we will be needing</p>

<pre><code>\newcounter{coderemarks}
\setcounter{coderemarks}{1}
\newcounter{codevar}
\setcounter{codevar}{1}
</code></pre>

<p>And now the crux of the code. With <code>\global</code> and <code>\def</code> you define a <em>global</em>
new command. This command has to be global otherwise it is only visible
inside the environment where you defined it and you can not use it later
on when the explanation is to be rendered. With 
<code>csname codebox\the\value{coderemarks}\endcsname</code> 
I generate a string for
<img class="inline-math" src="/gfx/mathtex.png" alt="LaTeX"/>
to interpret. The string will become something like <code>codebox1</code> or
<code>codebox2</code>. Those will be the names of the commands to are to be defined
and hold the text.</p>

<p>The <code>tikz</code> stuff is a very nice <code>picture</code> environment which draws a black
circle with a number rendered in white in it.</p>

<pre><code>\newcommand{\longremark}[1]{%
\tikz\node[text=white,font=\sffamily\bfseries,inner sep=0.2mm,draw,circle,fill=black]{\arabic{coderemarks}};%
\global \expandafter\def \csname codebox\the\value{coderemarks}\endcsname{#1}%
\stepcounter{coderemarks}%
}
</code></pre>

<p>And now the code to display your remarks later on. Basically this is a
while-loop that renders an item list. In the body of the loop the 
command names are also constructed in the same way as in <code>\longremark</code>,
but now they are not defined, but called. The bullets used are drawn
in the same way with <code>\tikz</code>.</p>

<pre><code>\newcommand{\showremarks}{%
\begin{list}{%
\tikz\node[text=white,font=\sffamily\bfseries,inner sep=0.2mm,draw,
circle,fill=black]% 
{\arabic{codevar}};}{\setlength{\labelsep}{2.0\labelsep}}
\whiledo{\value{codevar} &lt; \value{coderemarks}}{
\item \expandafter\csname codebox\the\value{codevar}\endcsname
\stepcounter{codevar}%
}
\end{list}
\setcounter{coderemarks}{1}%
\setcounter{codevar}{1}%
}
</code></pre>

<p>The usage of these commands in your code should be quite transparent. (I
could turn this into a proper package -- and maybe something like this
<em>already</em> exists &mdash; don't know).</p>

<p>The following is an example of how to use it. We define a code
listing using the <code>lstlisting</code> package. At interesting spots
in the listing we use <code>\longremark</code> and give our remark.</p>

<pre><code>\begin{lstlisting}
type stack struct { |\longremark{\emph{stack} is not exported}|
i    int 
data [10]int  |\longremark{Meer gezeur wat in dit geval ook %
            djskdjkd sjd skjfk fjdkf jdkf jfk dfj d TODO %
            djskdjkd sjd skjfk fjdkf jdkf jfk dfj d TODO %
            \newline %
            djskdjkd sjd skjfk fjdkf jdkf jfk dfj d TODO %
over meerdere regels heen gaat, oh waar moet dat }|
}
\end{lstlisting}
</code></pre>

<p>And when we want to see our remarks we just give</p>

<pre><code>\showremarks
</code></pre>

<p>to render it.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2010/02/05/latex_nirvana/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2010/02/05/latex_nirvana/index.html</guid>
<title>LaTeX Nirvana</title>
<dc:date>2010-02-05T16:23:42+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex</dc:subject>
<description><![CDATA[<p>I'm no fan of Word or OpenOffice for that matter, all that WYSIWYG stuff
is not for me. For years now I'm using
<a href="http://www.latex-project.org/">LaTeX</a> for my editing
needs. An added bonus for using LaTeX is that the output is stunning.</p>

<p>But for <em>really</em> nice looking output I wanted the following:</p>

<ul>
<li>Fonts in images/graphics should match the font of the main document</li>
<li>TrueType fonts, instead of the standard TeX fonts. To avoid
the "Heeh, that looks like a LaTeX document"-reactions;</li>
<li>UTF-8 support and international character support;</li>
<li>Easy integration of images (SVG based);</li>
<li>Automatic building.</li>
</ul>

<p>I'm using the following tools for this:</p>

<ul>
<li>Inkscape and <code>pdfcrop</code> for graphics generation;</li>
<li>make for building;</li>
<li>VI for editing (with syntax highlighting);</li>
<li>evince as PDF viewer;</li>
<li>xelatex for building the pdf.</li>
</ul>

<h1>General setup</h1>

<p>As <a href="http://www.miek.nl/s/d7c7a15ac3/">said earlier</a>, I'm a fan of
the <code>memoir</code> class as a replacement of the standard LaTeX classes. So
I'm using it here again. When you are using <code>xelatex</code> (better UTF-8
support) you should also include the package <code>xltxtra</code> and <code>xunicode</code>.</p>

<h1>Fonts</h1>

<p><em>The</em> package for TrueType font support is <code>fontspec</code>, to keep
the math fonts working I had to include the package as
<code>\usepackage[cm-default]{fontspec}</code>. </p>

<p><small>Note: <code>fontspec</code> mandates <code>xelatex</code>.</small></p>

<p>To use special characters I also found the <code>pifont</code> package. In my
current working document I use the Liberation Fonts and Courier New:</p>

<pre><code>\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[SmallCapsFont={* Caps}]{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[SmallCapsFont={Courier New}]{Courier New}
\fontsize{10}{10}
</code></pre>

<p>LaTeX will make TrueType fonts slightly larger than its core
fonts, the <code>Scale=MatchLowercase</code> tries to remedy that.</p>

<h1>Graphics</h1>

<p>I'm using Inkspace to draw my graphics, an added bonus for
using TrueType fonts in my LaTeX documents is that I can 
use the same fonts in the Inkspace drawings. So any text
I add will be of the font Liberation Serif at 10 points.</p>

<p>Further more Inkscape has the nice feature that it can be
used on the command line</p>

<pre><code>$ inkscape --export-pdf=drawing.pdf drawing.svg
</code></pre>

<p>generates the pdf file. To make it fit in the document
we need to crop the resulting pdf</p>

<pre><code>$ pdfcrop drawing.pdf output.pdf &amp;&amp; mv output.pdf drawing.pdf
</code></pre>

<p>And now we are left with a nice, cropped, pdf. See 
<a href="http://en.wikibooks.org/wiki/LaTeX/Importing_Graphics">this link</a>
on how to include graphics in your LaTeX document, I just use:</p>

<pre><code>\begin{figure}[h!b]
\includegraphics{drawing.pdf}
\caption{Fake caption line.}
\end{figure
</code></pre>

<p>Which will probably be extended somewhat to allow for cross references
(search for <code>\label</code> and <code>\ref</code>).</p>

<h1>Building</h1>

<p>To help in the sometimes tedious building of LaTeX documents, I use
<code>make</code>. For instance creating the pdf graphic files from the svg 
source files is done with the following Makefile:</p>

<pre><code>pdfs := $(patsubst %.svg,%.pdf,$(wildcard *.svg))

%.pdf: %.svg
    inkscape --export-pdf=$@ $&lt;
    pdfcrop $@ output.pdf &amp;&amp; mv output.pdf $@

all: ${pdfs}

clean:  
    rm -f *.pdf
</code></pre>

<p>The only thing I need to do is to create a file with Inkscape,
save it and run <code>make</code>.</p>

<p>For the document itself I'm using a similar, small Makefile.</p>

<pre><code>.PHONY: fig

all:    fig go.pdf

go.pdf: go.tex go-setup.tex chapter*.tex ex*.tex src/*.go 
    xelatex go.tex &amp;&amp; xelatex go.tex

fig:    fig/*.svg
    ( cd fig; make all )

clean:
    rm -f go.lol go.aux go.log map.log go.pdf
    ( cd fig; make clean )
</code></pre>

<h1>Putting it all together</h1>

<p>Next to the above Makefiles I have the following in the
preamble:</p>

<pre><code>\documentclass[a4paper,openany]{memoir}
\usepackage[cm-default]{fontspec}% provides font selecting commands
\usepackage{xunicode}% provides unicode character macros
\usepackage{xltxtra} % provides some fixes/extras
\usepackage[answerdelayed,lastexercise]{exercise}
\usepackage{pifont}
\usepackage{caption}
\usepackage{alltt}
\usepackage{url}
\usepackage{listings}
\usepackage{color}
\usepackage{graphicx}

\defaultfontfeatures{Scale=MatchLowercase}
\setmainfont[SmallCapsFont={* Caps}]{Liberation Serif}
\setsansfont{Liberation Sans}
\setmonofont[SmallCapsFont={Courier New}]{Courier New}
\fontsize{10}{10}
\graphicspath{{fig/}} % set default import pat

% among other \newcommands the follow environment for
% indented alltt (verbatim) text
\newenvironment{display}{%
  \def\FrameCommand{\hskip\parindent}%
  \MakeFramed {\advance\hsize-\width \FrameRestore}%
  \small
  \begin{alltt}
  }%
{\end{alltt}\endMakeFramed}
</code></pre>

<p>My master text <code>go.tex</code> used <code>\input</code> to include all other pieces
of text, so there I have:</p>

<pre><code>\chapter{Intro}
\input{chapter-intro.tex}
</code></pre>

<p>This keeps the main document file nice and clean and you can easily
re-arrange entire chapters. After any significant change I just
run <code>make</code> and view the resulting pdf file with <code>evince</code>, which is
an awesome pdf viewer btw. It looks something like this:</p>

<p><img src="http://www.miek.nl/gfx/2010/tex.png" width="400" alt="Screenie of sample page"/></p>

<p>The <em>very-much-work-in-progress</em> pdf can be seen
<a href="http://www.miek.nl/downloads/2010/go.pdf">here</a>.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2009/07/17/a_library_at_home/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2009/07/17/a_library_at_home/index.html</guid>
<title>A library at home</title>
<dc:date>2009-07-17T20:20:44+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> perl, latex, linux</dc:subject>
<description><![CDATA[<p>I've told a few 
<a href="http://www.miek.nl/s/61ba93ac0b/">times about how</a>
<a href="http://www.miek.nl/s/b3021c7414/">to build a library</a>.</p>

<p>But there a some extra things that must be done before you can call 
yourself a complete librarian.</p>

<ol>
<li>ID-ing the books you have</li>
<li>Storing the information </li>
<li>Marking the books</li>
<li>Sorting and shelving the books</li>
<li>Remembering who borrowed what</li>
</ol>

<h1>ID-ing books</h1>

<p>For this I bought a barcode reader that reads the ISBN number
of the book's backcover. With <code>book_get</code> 
(<a href="http://www.miek.nl/downloads/2009/book_get">Perl code</a>)
I can retrieve the author, title, genre and year published from Google.</p>

<pre><code>% book_get 9789024546497
Cryptonomicon
Neal Stephenson
none
2005
#Cryptonomicon&amp;#8206;by Neal Stephenson, Irene Ketman - 2005
</code></pre>

<p>Getting the genre right is a bit of a problem as Google will
not always report the correct genre (or just slightly different,
i.e. sometimes 'science' and sometimes 'computer science'). I
solved this by explicitly asking for the genre in the next step.</p>

<p>Also the html returned is awful, so sometimes this script looses
its way.</p>

<h1>Storing the information</h1>

<p>Getting the information is the first step, now it needs to be stored
somewhere. In a SQLite database for instance. I've made a minimal
database with only one table which holds all information: title,
genre, author, isbn, and a few more items.</p>

<p>With <code>book_sql</code> 
(<a href="http://www.miek.nl/downloads/2009/book_sql">perl code</a>)
the information retrieved with <code>book_get</code> is 
normalized (correct the genre) and put into the SQLite db.</p>

<h1>Marking the books</h1>

<p>To help with this 
<a href="http://www.miek.nl/s/b3021c7414/">I needed a label writer</a> to
print the author, genre and title on a small label. Currently I am
not confident enough to automate the printing of the labels so 
I manually query the database and feed the rows to <code>labelfmt</code>
(<a href="http://www.miek.nl/downloads/2009/labelfmt">Perl code</a>). This
little scripts uses LaTeX to format the labels and will print the
resulting <code>pdf</code> on the labelwriter.</p>

<pre><code>% sqlite3 biblio.db
sqlite&gt; select * from books where title like '%crypto%';
146|9789024546497|Cryptonomicon|Neal Stephenson, Irene Ketman|science fiction|2005|1201339561|
</code></pre>

<p>Now I give this text to <code>labelfmt</code> and it will print the label</p>

<pre><code>% ./labelfmt
146|9789024546497|Cryptonomicon|Neal Stephenson, Irene Ketman|science fiction|2005|1201339561|
....
</code></pre>

<p>And the labels gets printed:</p>

<p><img src="/gfx/2009/label.jpg" alt="label with print" title="Label with print" /></p>

<p>Next you will needed:</p>

<ul>
<li>little pieces of thick paper/carton; this is where you sticker the 
labels on. Like this:</li>
</ul>

<p><img src="/gfx/2009/label-on-paper.jpg" alt="paper with label" title="Paper with label" /></p>

<ul>
<li>little (120 x 120 mm) plastic triangles; which can be glued in each book, so that
the book's label can be put inside.</li>
</ul>

<p><img src="/gfx/2009/plastic.jpg" alt="plastic in book" title="Plastic in book" /></p>

<p>And insert the label:</p>

<p><img src="/gfx/2009/label-in-book.jpg" alt="label in book" title="Label in book" /></p>

<p>And another one is ready :-)</p>

<h1>Sorting and storing</h1>

<p>We decided to catalog our books based on genre. So I made
a map to tell which genres are placed where. Sorta like</p>

<ul>
<li>COMPUTER - left shelve in the living room </li>
<li>SCIENCE  - middle shelve in the living room</li>
<li>... - somewhere else</li>
</ul>

<p>So there you have it a full blown library setup for you books
at home. </p>

<h1>Borrowing</h1>

<p>Now if somebody want to read one of our book it is simply a
matter of: locating the book, getting the label out, writing
the person's name on the label and storing the label in a
safe place until the book is returned.</p>

<p>This last step could also be automated by using the barcode reader,
but the desktop computer in our living room is not powered on
100% of the time. Booting the machine takes too long and makes
it too cumbersome if someone just wants to borrow a book.</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2009/07/07/using_latex_with_a_label_writer/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2009/07/07/using_latex_with_a_label_writer/index.html</guid>
<title>Using LaTeX with a label writer</title>
<dc:date>2009-07-07T23:31:18+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex, linux</dc:subject>
<description><![CDATA[<p>I wanted to pretty print my labels on my (new) Dymo 400 label writer. All the
howtos I found were detailing how to use LaTeX to print a sheet of
labels. But I needed some LaTeX-foo to print only one. So /me to the
rescue...</p>

<p>My labels are 36mm X 89 mm (Dymo part #99012) after some trial and
error and four misprinted labels I came to the following LaTeX
code which fits the text on the labels:</p>

<pre><code>\documentclass{memoir}
\setstocksize{36mm}{89mm} %% dymo 99012 paper
\setlength{\headheight}{0mm}
\setlength{\headsep}{-28mm}
\setlength{\textwidth}{72mm} %% -17 mm
\setlength{\textheight}{28mm} %% -8 mm
\setlength{\oddsidemargin}{-16mm}
\setlength{\parindent}{0mm}

\begin{document}
...
\end{document}
</code></pre>

<p>For the actual text on the labels I use the following code (this should
be placed at the dots (...) in the code above.</p>

<pre><code>\sffamily
\textbf{My title}

\qquad The Author \\

\qquad\textbf{Genre} \\

ISBN: \textbf{9-785170-271955}\hfill2008
</code></pre>

<p>This LaTeX code is created by a little Perl script:</p>

<pre><code>#!/usr/bin/perl
# labelfmt
# format bib db so that we can print labels
# gets standard sqlite text input:
# 663|9785170271955|Wat 3a Warom (russisch)|B. Barhep|computer|1998|1221413368|

use strict;
use warnings;
my $labelfile = "/tmp/label";

$_ = &lt;&gt;;  # only read one label at the time

my ($id, $i, $tit, $a, $g, $y) = split /\|/, $_;

# format the isbn number a bit
my @i = split //, $i;
local $"="";
$i = $i[0] . "-" . "@i[1..6]" . "-" . "@i[7..12]";

open TEX, "&gt;", $labelfile . ".tex"; # yes, unsafe
select TEX;

print &lt;&lt;'EOF';
\documentclass{memoir}
\setstocksize{36mm}{89mm} %% dymo 99012 paper
\setlength{\headheight}{0mm}
\setlength{\headsep}{-28mm}
\setlength{\textwidth}{72mm} %% -6 mm
\setlength{\textheight}{28mm} %% -6 mm
\setlength{\oddsidemargin}{-16mm}
\setlength{\parindent}{0mm}

\begin{document}
\pagestyle{empty}
\sffamily
EOF

printf "\\textbf{%.30s}\n\n", $tit;
printf "\\qquad %.30s \\\\\n\n", $a;
printf "\\qquad\\textbf{%.30s} \\\\\n\n", uc $g;
printf "ISBN: \\textbf{%s}\\hfill%d\n", $i, $y;

print '\end{document}', "\n";
close TEX;

# now we make the pdf - after we clean up, the mess
if (system("pdflatex $labelfile") != 0) {
warn "Er ging iets falikant verkeerd";
} else {
unlink $labelfile . ".log", $labelfile . ".aux";
}
</code></pre>

<p>This will yield the following result</p>

<p><img src="http://www.miek.nl/gfx/2009/label.png" alt="Example Label" title="" /></p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2008/08/02/my_favorite_latex_preamble/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2008/08/02/my_favorite_latex_preamble/index.html</guid>
<title>My favorite LaTeX preamble</title>
<dc:date>2008-08-02T19:56:04+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex</dc:subject>
<description><![CDATA[<p>I've written quite a few LaTeX documents during the last few years, but
only recently I'm starting to discover very powerful new packages, like
<code>memoir</code> and <code>xelatex</code>.</p>

<p>So I just wanted to share my "new" way of writing LaTeX docs.</p>

<p>First read <a href="http://downloads.miek.nl/2008/memman.pdf">the memoir class
documentation</a>.
And the <a href="http://downloads.miek.nl/2008/fontspec.pdf">fontspec doc</a>.</p>

<h2>preamble</h2>

<p>This now looks like</p>

<pre><code>\documentclass{memoir}
\usepackage{eurosym}    %% for the EURO
\usepackage{fontspec}   
\usepackage{xltrxta}    %% \XeTeX if you need it
</code></pre>

<p>Usually this is hidden in one of my class files which implement
a new look for a document. See the following articles for some
examples</p>

<ul>
<li><a href="http://www.miek.nl/blog/archives/2008/06/28/a_new_latex_style/index.html">atroff style</a></li>
<li><a href="http://www.miek.nl/blog/archives/2007/12/21/blockbook_cls_a_latex_class/index.html">blocksbook style</a></li>
</ul>

<h2>example</h2>

<p>This is a small example on how to use XeTeX</p>

<pre><code>\documentclass{article}
\usepackage{fontspec}
\begin{document}
Testing XeLaTeX!

\fontspec[Scale=0.9]{Trebuchet MS}
Something in trebuchet, but too large

\fontspec[Scale=MatchLowercase]{Trebuchet MS}
Size adjusted to the rest of the text!

\LaTeX rules

\rmfamily
\LaTeX in the normal font
\end{document}
</code></pre>

<p>Generate the <code>pdf</code> with</p>

<pre><code>xelatex example.tex
</code></pre>

<p><code>xelatex</code> is my new friend now :)</p>]]></description>

</item>
<item>
<link>http://www.miek.nl/blog/archives/2008/07/29/truetype_fonts_in_latex_the_easy_way_on_debianunbuntu/index.html</link>
<guid isPermaLink="true">http://www.miek.nl/blog/archives/2008/07/29/truetype_fonts_in_latex_the_easy_way_on_debianunbuntu/index.html</guid>
<title>truetype fonts in LaTeX the easy way (on Debian/Unbuntu)</title>
<dc:date>2008-07-29T19:04:32+01:00</dc:date>
<dc:creator>Miek Gieben</dc:creator>
<dc:subject> latex</dc:subject>
<description><![CDATA[<p>Steps:</p>

<ol>
<li><p>Read:
How to use 
<a href="http://existentialtype.net/2008/07/12/fonts-in-latex-part-one-xelatex/">nice fonts in LaTeX</a></p></li>
<li><p>Install the software:</p>

<p><code>sudo apt-get install texlive-xetex</code> </p>

<p><code>sudo apt-get install lcdf-typetools</code></p>

<p>The latter one is needed for <code>otfinfo</code> to determine the font family
name.</p></li>
<li><p>Read /usr/share/doc/texlive-doc/xetex/XeTeX-reference.pdf</p></li>
<li><p>Use <code>xelatex</code> to create the <code>pdf</code> of your LaTeX documents</p></li>
</ol>

<p>If you get the following error install the package <code>lmodern</code></p>

<pre><code> LaTeX Error: File `lmodern.sty' not found.
</code></pre>

<p>Finally I can use truetype fonts in my LaTeX documentation. <em>Sweet</em>!</p>]]></description>

</item>
</channel>
</rss>

