Feeds:
Posts
Comments

Posts Tagged ‘LaTeX’


On a previous post I described how to change the LaTeX options of the Cadabra notebook.

I collaborate with a colleague, who uses the standard cadabra installation. Therefore, If I write a Cadabra notebook, he needs to pullback the personalised notebook to the standard one. The pullback script can be downloaded here!!!

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 20:20

Emacs 24.3.1 (Org mode 8.2.5h)

Validate

Read Full Post »


Just by playing around with CADABRA, I found out the existence of a super-useful LaTeX package, called breqn, which allows to break long equations at the edge of the page… like the wraping feature of most text editors.

However, when one manipulates really long expressions, I’d like to break these long equations through the page. I’m still looking for this feature… in that case I can improve even more the behaviour of cadabra‘s notebook, when compiling it to LaTeX.

Any suggestions???

Cheers!

Read Full Post »


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

Author: Oscar Castillo-Felisola

Created: 2014-02-18 Tue 10:09

Emacs 24.3.1 (Org mode 8.2.5h)

Validate

Read Full Post »


A quick tip: When writing a long aligned equation, use the following command, \allowdisplaybreaks in the preamble.

Example

\documentclass{report}
\usepackage{amsmath}
\usepackage{lipsum}
\allowdisplaybreaks

\begin{document}
\lipsum[1-4]
\begin{align*}
Ffffffffffffffffffffffffffffff &= \partial_t(p)\\
  &= \partial_t(m v)\\
  &= m a\\
  &= m \dot{v}\\
  &= m \ddot{x}\\
  &= \partial_t(p)\
  &= \partial_t(m v)\\
  &= m a\\
  &= m \dot{v}\\
  &= m \ddot{x}
\end{align*}
\end{document}

Read Full Post »


I used Inkscape a couple of time… just for fun, and I was impressed. However, last week I used it for some work-related stuff.

I wrote a paper, and the core of it was a numerical analysis of a set of differential equations. The solution was plotted, but the 3D manager of the software I tried was not wonderful, and the referee complained because the axis were not label.

Here the chaos began:

  • My plots were PDF files,
  • Somehow, the data files and program codes were missing!!!
  • After two months, I did not wanted to spend more time re-programming and running simulations.

Thus, the idea came to me, What if… I use a graphical program to insert the labels?

And I did!!!!

I tried first with GIMP, but it is a bit cumbersome… and the worst part is that I did not know hot to add LaTeX symbols. Meanwhile, Inkscape has and extension to render  LaTeX formulas.

I’ll be coming back to Inkscape. It’s great, so make sure to include it in your first aids kit.

DOX

Read Full Post »


Hi everyone, I’ve include the code for drawing Dynkin diagrams using Tikz package in LaTeX

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,0) node[anchor=east]  {$A_n$};
    \foreach \x in {0,...,5}
    \draw[xshift=\x cm,thick] (\x cm,0) circle (.3cm);
    \draw[dotted,thick] (0.3 cm,0) -- +(1.4 cm,0);
    \foreach \y in {1.15,...,4.15}
    \draw[xshift=\y cm,thick] (\y cm,0) -- +(1.4 cm,0);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,0) node[anchor=east]  {$B_n$};
    \foreach \x in {0,...,4}
    \draw[xshift=\x cm,thick] (\x cm,0) circle (.3cm);
    \draw[xshift=5 cm,thick,fill=black] (5 cm, 0) circle (.3 cm);
    \draw[dotted,thick] (0.3 cm,0) -- +(1.4 cm,0);
    \foreach \y in {1.15,...,3.15}
    \draw[xshift=\y cm,thick] (\y cm,0) -- +(1.4 cm,0);
    \draw[thick] (8.3 cm, .1 cm) -- +(1.4 cm,0);
    \draw[thick] (8.3 cm, -.1 cm) -- +(1.4 cm,0);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,0) node[anchor=east]  {$C_n$};
    \foreach \x in {0,...,4}
    \draw[xshift=\x cm,thick,fill=black] (\x cm,0) circle (.3cm);
    \draw[xshift=5 cm,thick] (5 cm, 0) circle (.3 cm);
    \draw[dotted,thick] (0.3 cm,0) -- +(1.4 cm,0);
    \foreach \y in {1.15,...,3.15}
    \draw[xshift=\y cm,thick] (\y cm,0) -- +(1.4 cm,0);
    \draw[thick] (8.3 cm, .1 cm) -- +(1.4 cm,0);
    \draw[thick] (8.3 cm, -.1 cm) -- +(1.4 cm,0);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,0) node[anchor=east]  {$D_n$};
    \foreach \x in {0,...,4}
    \draw[xshift=\x cm,thick] (\x cm,0) circle (.3cm);
    \draw[xshift=8 cm,thick] (30: 17 mm) circle (.3cm);
    \draw[xshift=8 cm,thick] (-30: 17 mm) circle (.3cm);
    \draw[dotted,thick] (0.3 cm,0) -- +(1.4 cm,0);
    \foreach \y in {1.15,...,3.15}
    \draw[xshift=\y cm,thick] (\y cm,0) -- +(1.4 cm,0);
    \draw[xshift=8 cm,thick] (30: 3 mm) -- (30: 14 mm);
    \draw[xshift=8 cm,thick] (-30: 3 mm) -- (-30: 14 mm);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,0) node[anchor=east]  {$G_2$};
    \draw[thick] (0 ,0) circle (.3 cm);
    \draw[thick,fill=black] (2 cm,0) circle (.3 cm);
    \draw[thick] (30: 3mm) -- +(1.5 cm, 0);
    \draw[thick] (0: 3 mm) -- +(1.4 cm, 0);
    \draw[thick] (-30: 3 mm) -- +(1.5 cm, 0);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-3,0) node[anchor=east]  {$F_4$};
    \draw[thick] (-2 cm ,0) circle (.3 cm);
    \draw[thick] (0 ,0) circle (.3 cm);
    \draw[thick,fill=black] (2 cm,0) circle (.3 cm);
    \draw[thick,fill=black] (4 cm,0) circle (.3 cm);
    \draw[thick] (15: 3mm) -- +(1.5 cm, 0);
    \draw[xshift=-2 cm,thick] (0: 3 mm) -- +(1.4 cm, 0);
    \draw[thick] (-15: 3 mm) -- +(1.5 cm, 0);
    \draw[xshift=2 cm,thick] (0: 3 mm) -- +(1.4 cm, 0);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,1) node[anchor=east]  {$E_6$};
    \foreach \x in {0,...,4}
    \draw[thick,xshift=\x cm] (\x cm,0) circle (3 mm);
    \foreach \y in {0,...,3}
    \draw[thick,xshift=\y cm] (\y cm,0) ++(.3 cm, 0) -- +(14 mm,0);
    \draw[thick] (4 cm,2 cm) circle (3 mm);
    \draw[thick] (4 cm, 3mm) -- +(0, 1.4 cm);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,1) node[anchor=east]  {$E_7$};
    \foreach \x in {0,...,5}
    \draw[thick,xshift=\x cm] (\x cm,0) circle (3 mm);
    \foreach \y in {0,...,4}
    \draw[thick,xshift=\y cm] (\y cm,0) ++(.3 cm, 0) -- +(14 mm,0);
    \draw[thick] (4 cm,2 cm) circle (3 mm);
    \draw[thick] (4 cm, 3mm) -- +(0, 1.4 cm);
  \end{tikzpicture}
\end{center}

\begin{center}
  \begin{tikzpicture}[scale=.4]
    \draw (-1,1) node[anchor=east]  {$E_8$};
    \foreach \x in {0,...,6}
    \draw[thick,xshift=\x cm] (\x cm,0) circle (3 mm);
    \foreach \y in {0,...,5}
    \draw[thick,xshift=\y cm] (\y cm,0) ++(.3 cm, 0) -- +(14 mm,0);
    \draw[thick] (4 cm,2 cm) circle (3 mm);
    \draw[thick] (4 cm, 3mm) -- +(0, 1.4 cm);
  \end{tikzpicture}
\end{center}

Bye

DOX

Read Full Post »


If you want to compile a file, say Base.tex, and get the PDF with other name, use the -jobname option

$ pdflatex -jobname MyBook Base.tex

In the example you’ll get a PDF file called MyBook.pdf

Enjoy

Read Full Post »

Older Posts »