Feeds:
Posts

## Posts Tagged ‘Debian’

Goal: a cadabra notebook more LaTeX friendly.

1. I run a Debian system. Don’t know why, but the original source code in the git repo didn’t work!!!What did I do? I downloaded the code from the Debian repository.
$sudo apt-get build-dep cadabra # Install all dependences$ mkdir -p ~/Software # Create a folder to download the source
$cd ~/Software # Move to the folder$ apt-get source cadabra # Download the source code (from Debian)
2. On the cadabra folder created through the last command line, I looked for the window.cc file and open it
$emacs cadabra-1.29/gui/window.cc & 3. On the window.cc file I changed: • The LaTeX package color by the improved xcolor, by changing the string << "\\usepackage[usenames]{color}\n" by << "\\usepackage{xcolor}\n" • I added the LaTeX package listings, which improves the verbatim properties (among other things). Right after the mentioned xcolor line, I added the following << "\\usepackage{listings}\n" << "\\lstset{\n" << " basicstyle=\\small\\color{blue}\\ttfamily,\n" << " breaklines=true,\n" << " columns=fullflexible,\n" << " commentstyle=\\color{gray!60},\n" << " morecomment=[l]{\\%\\%},\n}" This allows the Cadabra code to break at the end of the line instead of going out of the page, when compiled to LaTeX (similar to what breqn does on equations). • Now, I changed on the DataCell::c_input: case,1 the strings {\\color[named]{Blue}\\begin{verbatim}\n by \\begin{lstlisting}\n, and \n\\end{verbatim}}\n by \n\\end{lstlisting}\n.Far below, the lines with the code if(ln=="{\\color[named]{Blue}\\begin{verbatim}") { should be changed to if(ln=="\\begin{lstlisting}") {, as well as else if(ln=="\\end{verbatim}}") { should be changed to else if(ln=="\\end{lstlisting}") {. • Save all the changes 4. Finally, time to compile$ ./configure
$make$ sudo make install
5. If your compilation/installation went through, and you try to open an old cadabra notebook (a notebook created with the original cadabra code), the program will complain that the file is not compatible… but I created a small script to transform the old files into new files! Download it here!!USAGE:
$./transf_cadabra oldfile.cnb newfile.cnb ## Footnotes: 1This is located a few lines below the lines where the LaTeX preamble is defined Created: 2014-02-18 Tue 10:09 Emacs 24.3.1 (Org mode 8.2.5h) Validate Advertisements Read Full Post » ## aptitude: Packages code keys Hello everyone, Before I install packages, I’d like to check their status using aptitude,$ aptitude search gimp
p   extremetuxracer-gimp-dev        - plugins for GIMP for easy development of e
i   gimp                            - The GNU Image Manipulation Program
p   gimp-cbmplugs                   - plugins for The GIMP to import/export Comm
i A gimp-data                       - Data files for GIMP
i   gimp-data-extras                - An extra set of brushes, palettes, and gra
p   gimp-dbg                        - Debugging symbols for GIMP
p   gimp-dds                        - DDS (DirectDraw Surface) plugin for GIMP
p   gimp-dimage-color               - GIMP plugin to convert Minolta DiMAGE pict
p   gimp-flegita                    - Scanner plugin for the GNU image manipulat
p   gimp-gap                        - animation package for the GIMP
p   gimp-gluas                      - Lua environment plug-in for GIMP
i A gimp-gmic                       - GREYC's Magic for Image Computing - GIMP P
p   gimp-gutenprint                 - print plugin for the GIMP
v   gimp-help                       -
p   gimp-help-common                - Data files for the GIMP documentation
p   gimp-help-de                    - Documentation for the GIMP (German)
p   gimp-help-en                    - Documentation for the GIMP (English)
p   gimp-help-es                    - Documentation for the GIMP (Spanish)
p   gimp-help-fr                    - Documentation for the GIMP (French)
p   gimp-help-it                    - Documentation for the GIMP (Italian)
p   gimp-help-ko                    - Documentation for the GIMP (Korean)
p   gimp-help-nl                    - Documentation for the GIMP (Dutch)
p   gimp-help-nn                    - Documentation for the GIMP (Norwegian)
p   gimp-help-pl                    - Documentation for the GIMP (Polish)
p   gimp-help-ru                    - Documentation for the GIMP (Russian)
p   gimp-help-sv                    - Documentation for the GIMP (Swedish)
v   gimp-helpbrowser                -
p   gimp-lensfun                    - Gimp plugin to correct lens distortion usi
i   gimp-plugin-registry            - repository of optional extensions for GIMP
v   gimp-python                     -
p   gimp-resynthesizer              - Transitional package for gimp-plugin-regis
v   gimp-save-for-web               -
p   gimp-texturize                  - generates large textures from a small samp
p   gimp-ufraw                      - gimp importer for raw camera images
p   gtkam-gimp                      - gtkam gimp plugin to open digital camera p
i A libgimp2.0                      - Libraries for the GNU Image Manipulation P
p   libgimp2.0-dev                  - Headers and other files for compiling plug
p   libgimp2.0-doc                  - Developers' Documentation for the GIMP lib
p   libgimpactutils2.81             - professional 3D Game Multiphysics Library
p   planetpenguin-racer-gimp-dev    - Dummy transition package for extremetuxrac

I won’t lie to you… from the very beginning I knew that the i at the first column meant installed… but What about the other keys?

I found the answer by looking at the documentation, using

$man aptitude Here’s is the thing: Each search result is listed on a separate line. The first character of each line indicates the current state of the package: the most common states are p, meaning that no trace of the package exists on the system, c, meaning that the package was deleted but its configuration files remain on the system, i, meaning that the package is installed, and v, meaning that the package is virtual. The second character indicates the stored action (if any; otherwise a blank space is displayed) to be performed on the package, with the most common actions being i, meaning that the package will be installed, d, meaning that the package will be deleted, and p, meaning that the package and its configuration files will be removed. If the third character is A, the package was automatically installed. Great!!! Isn’t it? Cheers! Read Full Post » ## Installation and Upgrade of LMDE (Linux Mint DEbian) Hello there! Yesterday I installed Linux Mint DEbian (or LMDE) on one of my machines. If you check the Blog Website, the last released version was the 201303. From last March until now, a lot of packages have been updated, therefore it is customary to update (and upgrade) the system right after the installation. Nonetheless, if you do that… things will go completely wrong. Fortunately, I found this post on the official Linux Mint forum. Thus I post the steps I follow 1 # apt-get update # apt-cache policy debian-system-adjustments if the Installed and Candidate packages are not the same, then install the new one… and then proceed to the upgrade of the system, # apt-get install debian-system-adjustments # apt-get dist-upgrade Cheers. #### Footnotes: 1You will need root power, or using the sudo command at the beginning of each line Read Full Post » ## Linux TIP: Installing Skype 4.2 on Debian According to this post, the instructions to install the latest Skype on Debian are$ sudo dpkg --add-architecture i386
$sudo apt-get update$ sudo apt-get upgrade
$sudo dpkg -i skype-debian_4.1.0.20-1_i386.deb$ sudo apt-get install -f
$sudo dpkg -i skype-debian_4.1.0.20-1_i386.deb I followed these instructions and it worked alright on my second try!… Don’t know why the first time my Skype account was not recognised. Ok, if it work… just remember that credit is not mine! Cheers Created: 2013-10-14 Mon 11:25 Emacs 23.4.1 (Org mode 8.2.1) Validate Read Full Post » ## Installing SAGE from the source on Debian. I’m installing SAGE1 v.5.12 on my laptop which runs Debian. Here I describe the procedure. 1. Since there is no Debian binary package, you should download the source code. Here the link. 2. When it finishes, open a terminal C-M-t (sorry for the emacs notation, it means Ctrl+Alt+t) • Go to the Downloads folder (or the right place where the tar file was saved)$ cd ~/Downloads
• Untar the file
$tar xvf sage-5.12.tar • Move to the sage-5.12 folder just created cd sage-5.12/ 3. Install the dependencies of the first line. Optionally install LaTeX and ImageMagick using the second line. (NOTE: superuser power is needed to run the below code)$ sudo apt-get install -y gcc perl m4 dpkg-dev
$sudo apt-get install -y texlive imagemagick 4. In machines with more than one core, the instruction to perform parallel compilation is (yo should change the “4” by the amount of cores in your machine)$ export MAKE="make -j4"
5. Now is time to compile the code.For a local compilation, run
make

For a
You can relax, go and have a coffee, because the compilation may longs one hour (or more depending of the machine specifications).

6. For running the software after the installation is complete, run (on the SAGE directory) the command
$./sage • I don’t like to move to the SAGE directory every time and then run the ./sage command, therefore, I tend to create an alias on my ~/.bash_aliases file,$ echo "alias sage="sh ~/Downloads/sage-5.12/sage" >> ~/.bash_aliases

This command adds the line alias sage="sh ~/Downloads/sage-5.12/sage at the end of the file ~/.bash_aliases, you can do it by hand with your favourite editor (gedit, emacs, nano, vim, …)

• If you refresh your terminal (or open a new one) you just have to run the command sage to start SAGE. Additionally, the notebook environment can be started directly from the terminal by using the flag -n,
$sage -n Hope you find this post useful! Remember to leave your comments or suggestions. Enjoy! ## Footnotes: 1SAGE is an open source mathematical software which allows numerical and symbolic manipulations Read Full Post » ## Installing Inkscape in Debian-based Linux 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!

DOX

## Document edition with LaTeX

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. \documentclass{report} \begin{document} \end{document} 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, \documentclass{report} \begin{document} \chapter{Introduction} \end{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, \documentclass{report} \begin{document} \chapter*{Introduction} \end{document} 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,

\documentclass{report}
\title{My first document in \LaTeX{}}
\author{Dox Drum}
\date{\today}

\begin{document}

\maketitle

\chapter*{Introduction}

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).$$

\end{document}

### Listing

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

\begin{itemize}
\item This got no number
\item Neither does it!
\begin{enumerate}
\item This is number one
\item number two
\end{enumerate}
\item Another with no number
\end{itemize}

which is a numbered list inside a unnumbered one.