Posts Tagged ‘PDF’

Hi again!

In the last post I told you about my experience with Inkscape, and now I’ll show you how to install this software using the command line interface (CLI) in dabian-like linux.

Inkscape is include into the repository list, thus, the only thing we need to do is to open a terminal Alt+F2 and type terminal or Ctrl+Alt+t in Ubuntu or Mint.

In the terminal type

 $ sudo apt-get install inkscape pstoedit

Note that you will need administrator powers. I’ve include the package pstoedit, which will allow you to insert LaTeX formulas… in case you need them, but also allows you to manipulate encapsulated figures, like eps ones.

See you soon!



Read Full Post »

When I started to write documents in \LaTeX, I found myself diving into .tex, .out, .aux, .pdf, .jpg files and so on. Thus I developed a system for organizing the files.

(If you are starting with \LaTeX might find useful my previous post here)

The Basic

First, I create a LaTeX folder in my personal Documents directory,

$ mkdir ~/Documents/LaTeX

where all my \LaTeX related files have to be moved.

Since I used to write a lot of reports, articles and letters, the next step is to write a template for each of them (Of course, you could use pre-defined templates, from your LaTeX editor, borrowed from a friend or downloaded from internet).

As an example, I’ve defined

  • base-art.tex
  • base-rep.tex
  • base-PRD.tex: for articles to be send to Physical Review journal.
  • base-book.tex
  • base-beamer.tex
  • base-lett.tex

More Folders

Now, more folder should be created to keep files ordered.

$ cd LaTeX
$ mkdir Docs Pics Finished

Here I’m describing just three, Docs contains the .tex files other than the base-*.tex, Pics contains all figures, and Finished is a place where you can move the PDF files when they are finished.

NOTE: Clearly, you could create folders inside Docs and Pics… say, one for Geography-hw and other for Zen-Martial-arts, and so on.

The base-*.tex File

This is the file which contains the structure of the document, that is:

  • the class
  • the preamble packages, definitions and so on…
  • the begin and end document.

but not the body content… except for the maketitle, tableofcontents, and similars.

So, Where is the content?

The content is written is separated tex files saved in the Docs folder. None of this files have class definitions or, package calls, or begin and end document… they have the written part, example:

%%%  UFO saved as UFO.tex
%%% in the ~/Documents/LaTeX/Docs folder


In the last years, UFO activity has been increased due to 
the lack of faith in the world. 

Do you believe?

\chapter{What is UFO?}
UFO stands for Unidentified Flying Object 

\section{UFO activity}
blah blah blah

and this should be included into the base-rep.tex file, with the input command,





NOTE: When you want to insert a file, which is not in the same folder than the base-*.tex one, the directory to that file must be given.

And the figures?

Now, figures are part of the body, thus they are included in the UFO.tex file, suppose we want to add the figure1.jpg, then our UFO.tex should contain a line like,


NOTE: although UFO.tex is located in Docs folder, the figure file is referred as Pics/figure1.jpg because the compiler starts looking at the “mother” folder, a.k.a., LaTeX.

Compiling the Thing

Of course, for compiling you should type in the terminal,

$ pdflatex base-rep.tex

however, the PDF document will have the same name as their parent tex file, i.e., base-rep.pdf

If you’d like to have a final PDF file with a different name, use instead,

$ pdflatex -jobname UFO base-rep.tex

to get a UFO.pdf file.



Read Full Post »

I define myself as a \LaTeX lover. I write all my documents using \LaTeX.

In this post I’d like to review some features about \LaTeX writing and compilation. Since I’m a Linux user, and don’t have any idea on how does windows work, I’ll restrict myself to Linux OS… particularly Debian based ones, such as, Ubuntu, Mint, and so on.

Installing the Compiler

The easiest way of installing the \LaTeX compiler in Debian based Linux, is through the Terminal, (you should have sudoes power)

$ sudo apt-get install texlive

or if you prefer to install all the possible packages,

$ sudo apt-get install texlive-full

NOTE: the full installation needs about 1GB of free pace in your HD, which is not too much by this days, however, downloading the installation packages could long couple of hours with ease.

Choose an Editor

One cannot write a \LaTeX file in a Word Processor as OpenOffice or LibreOffice. Nonetheless, there are different processors which are useful for this end,

  • Gedit: included in most Linux distributions
  • Emacs: a very powerful processor
  • Texmaker: specially designed for LaTeX, in GNOME environment
  • Kile: specially designed for LaTeX, in KDE environment

and many others,

  • Texila
  • Texshop
  • Texmacs
  • et cetera

You could install one or all of them, again using the CLI, for example,

$ sudo apt-get install texmaker emacs gedit-latex-plugin

First LaTeX Document

From now on, I’d restrict to Emacs editor (which is my favourite), the terminal for compiling the document, and evince as viewer.

NOTE: In case you choose to try emacs yourself, I recommend to check some old post of mine, about an emacs error, about environments, or emacs and LaTeX.

Three first lines

All \LaTeX document has the three very first lines which define it.


The first one define the type of document one’d like to write, some classes are

  • report: a book-like document, probably less complex
  • book: specially for writing books
  • article: for scientific articles
  • letter: for writing letters
  • beamer: for presentations (see for example this post)
  • currvita: for writing curricula vitae
  • and many more…

All that is written between the begin and end document is called the body of the document, in there all chapters, sections and so on is included.

A special part of the document is the area between the documentclass and the begin document. This is called preamble, and there all the special request about our document are specified.

Giving some Format

In order to start giving structure to our document, we need to know the kind of structures defined in \LaTeX,

  • part: for book and report classes
  • chapter: for book and report classes
  • section: for book, report and article classes
  • subsection: as above
  • subsubsection: as above
  • paragraph: as above
  • subparagraph: as above

by now, we restrict ourself to these three classes, because the other are quite different.

Each structure is understand as a command, thus it must be presided by the backslash and include into the body of the document,





As you might notice, the name of the chapter is enclosed by curly brackets.

NOTE 1: From part to subsubsection, structures are numbered by default. If you’d like to avoid the number, use an asterisk as shown below,





NOTE 2: A huge difference between a chapter (which I’m calling structure) and environment (such as document), is that the former ends when a new structure is given, while the later has a beginning and an end.

Some Environments

There are lots of different environments that might be used while writing a document, such as,

  • equation: for writing a single numbered equation. Use equation* for unnumbered ones.
  • eqnarray: for writing multiple numbered aligned equations. Use \nonumber for avoid a numbered line, \\ split the line, and && for telling where to align(the sign could be surrounding a sign).
  • quote: for quotations.
  • itemize: for unnumbered list.
  • enumerate: for numbered list.
  • figure: for adding numbered and possibly captioned figures.
  • table: for adding numbered and possibly captioned tables.
  • tabular: for constructing tables.
  • minipage: allows to construct a mini-paga on the document, like a post it!
  • and a long standing list which cannot be possible cover in a post!

Compiling the Document

Since \LaTeX is a programming language, one necessarily has to compile the document to get a PDF or PS (human) readable file.

The very fist step is to save the plain text file, the extension must be .tex, as it’s customary, I’ll call our foo.tex. Since compilation usually generates a lot of trash files, the best place to saave the plain text is in a folder dedicated for latex files.

In Emacs the keys

Ctrl-x Ctrl-s

abbreviated by  C-x C-s, saves the file… or buffer in Emacs jargon. The first time you save the file, a name must be given, ex.,  ~/Latex/foo.tex.

NOTE: I assume that a folder Latex was created in your home folder (~).

Once saved, go to the terminal and change the promt to the Latex folder,

 $ cd ~/Latex

and compile the file with pdflatex command

 $ pdflatex foo.tex

Finally open the document, with evince,

 $ evince foo.pdf &

😀 Yeah babe!!!! That’s right… your first document written in \LaTeX.

Writing Equations

I’m a physicist, so I’m used to write lots of equations. I’ll explain some examples,

\vec{F} = m \vec{a}

results in

\vec{F} = m \vec{a}

or the famous Einstein’s relation,

E = m c^2

results in

E = m c^2.

More complicated examples,

\frac{\partial^2 }{\partial t^2}x(t) + \omega^2 x(t) = 0\;\Rightarrow\; x(t) = A\sin(\omega t)+ B\cos(\omega t)

results in

\frac{\partial^2 }{\partial t^2}x(t) + \omega^2 x(t) = 0\;\Rightarrow\; x(t) = A\sin(\omega t)+ B\cos(\omega t)

With this example we opened the gate of Greek alphabet in mathematical mode, and Calculus notation… nevertheless, there exist endless possibilities. I encourage you to check symbols-a4.

The best of the compiled text, is that numbers (of section, chapter, equations, tables, or figures) are assigned by the compiler… therefore, you don’t need to remember those damn numbers. So, How do I refer to an equation?

First, give a name to the equation, with the label command

E = m c^2 \label{emc2}

and then, call it with the ref command,

As we saw before, the mass relation (\ref{emc2}), bla bla bla...

After the compilation the precise number appears.

NOTE: The same principle work for any other structure of the document or numbered environment.

And the Title Page?

As you have notice, there’s a huge difference between WYSIWYG editors (Office-like) and WYWIWYG ones (which must be compiled). The maketitle command orders to the compiler to create a title page. The data should be included in the preamble, whilst the command form part of the document body,

\title{My first document in \LaTeX{}}
\author{Dox Drum}




The harmonic oscillator is driven by the differential equation,
\frac{\partial^2 }{\partial t^2}x(t) + \omega^2 x(t) = 0\;\Rightarrow\; x(t) = A\sin(\omega t)+ B\cos(\omega t).



As we saw above, list are made with the commands itemize or enumerate, whether you want it to be numbered or not.

\item This got no number
\item Neither does it!
  \item This is number one
  \item number two
\item Another with no number

which is a numbered list inside a unnumbered one.

Download the PDF document!

Read Full Post »

For a publication I was working on, I plotted functions in  PDF format. However, the journal ask me to handle them in EPS format.

“What’s the point?” you might ask. Well, since I installed Lucid Lynx (a clean installation), the files of those graphic were gone… Fool of me, you will say, but really, I never thought that this days journals DO NOT accept PDF files!!!!

Who cares! to the point.

First I tried with the convert command

for i in *.pdf; do convert $i $(echo $i| sed -e s/pdf/eps/g); done

It did the job, but the quality of the plots was compromised.

Then, I move to Sage(math), and re-discover the function ‘graphics_array’, and try this,

p1 = plot(Vn(x, 1, 3), (x,-5,5), color='black', thickness=2)
p1 += plot(Vp(x, 1, 3), (x,-5,5), color='black', thickness=2, linestyle='-.',  \
  axes_labels=[r'$\xi^\prime', r'$V_{qm}(\xi^\prime)$'], fontsize=17)
p2 = plot(Vn(x, 3, 3), (x,-5,5), color='black', thickness=2)
p2 += plot(Vp(x, 3, 3), (x,-5,5), color='black', thickness=2, linestyle='-.', \
  axes_labels=[r'$\xi^\prime$',r''], fontsize=17)
p3 = plot(Vn(x, 5, 3), (x,-5,5), color='black', thickness=2)
p3 += plot(Vp(x, 5, 3), (x,-5,5), color='black', thickness=2, linestyle='-.', \
  axes_labels=[r'$\xi^\prime$',r''], fontsize=17)

… a little explanation?! p1, p2 and p3 are the graphics I’d like put into an array, each of them contain 2 plots (both black because otherwise they’ll make me pay an incredible amount of money… crazy people!), and them try the graphics_array,

ga = graphics_array([p1, p2, p3])
ga.show(frame=True, axes=False, figsize=[12,8])

and obtain something like this,

First try with graphics_array

Yeah babe!!!… What???!!! It’s not all right! What happened with the axis labels, the font size, and so on?

Second try: let’s see if the plots are working one by one


This is the right p1


The right p2


The right p3

The are alright! So, What happened? Let me run again the graphics_array commands

ga = graphics_array([p1, p2, p3])
ga.show(frame=True, axes=False, figsize=[12,8])

What did I get?…

The final result was as I wanted to be! 🙂

MORAL: Make Sage(math) show you the plot, one by one, before make them into an array!

Yeah… I almost forgot it!

My goal was to save it as an EPS file, so after getting the looked graph, the command is

ga.save(frame=True, axes=False, figsize=[12,8], \

Cya all!

Read Full Post »

There is a program in the repositories called PDFedit, which I never could use properly, but for simple edition, the flpsed application does it with ease.

To install it, type in the terminal

$ sudo apt-get install flpsed

Try it! You would find it useful for filling forms XD

Read Full Post »