A dummy package in Ubuntu for texlive

I was trying today to install bibtex2html in Ubuntu Precise, and I got the following message from the terminal:

~$ sudo apt-get install bibtex2html
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  lmodern luatex ocaml-base-nox tex-common texlive-base texlive-binaries
  texlive-common texlive-doc-base texlive-luatex

Now, I have already installed TeXLive 2012 manually, therefore I do not need lmodern, luatex, etc. I could find this page with instructions. Basically, I installed equivs, created a file texlive-local taking the example from the above address as model (noting, that, for example texlive’s version in precise is 2009-15), then ran:

$ equivs-build texlive-local

This created a file texlive-local_2009-15_all.deb, which I could install with:

$ sudo dpkg -i texlive-local_2009-15_all.deb

and then I could install bibtex2html without unnecessary extra packages.

In case it is useful for anybody else, here is the texlive-local file I used.

Posted in Ubuntu | Tagged | Leave a comment

TikZ figures in org mode files

TikZ images deserve a footnote in the Org-manual. For future reference, I include an example that seems to work.

Say we have a tikz diagram, in a file diagram.tex such as:

\begin{tikzpicture}
  \draw (0,0) grid (7,5);
  \draw (0,0) node[below left] {$A$};
  \draw (7,5) node[above right] {$B$};
  \fill (0,0) circle (2pt);
  \fill (7,5) circle (2pt);
\end{tikzpicture}

Then we can include it in an org file:

#+title: A test

* A TikZ figure

#+name: diag
[[./diagram.tex]]

It helps to set org-latex-image-default-width to the empty string, to avoid resizing the image when exporting to LaTeX. See the discusion here.

Posted in LaTeX | Tagged | Leave a comment

Org mode 8.0

Org mode was updated recently to version 8.0, and together with many great features, an unfortunate consequence it brought is that many lovely features of org2blog/wp no longer work. There is hope for the future, but in the meantime, I will post with Emacs 24.3.1, and the org-mode that comes with it (Org-mode version 7.9.3f).

Posted in Emacs | Tagged | Leave a comment

Updating bibsnarf for arxiv.org

bibsnarf.el is a nice tool to get BibTeX entries conveniently from Emacs. Even though it seems that it has not been updated since 2007, it still works with mathscinet, but not with arxiv.org. With the following redefinition, bibsnarf works for me with arxiv:

(defun bsn-arxive-url (author title)
  (concat "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?db_key=PRE&"
          "&aut_req=YES&aut_logic=AND&author=" (mm-url-form-encode-xwfu author)
          "&ttl_req=YES&ttl_logic=AND&title=" (mm-url-form-encode-xwfu title)
          "&data_type=BIBTEX"))

It would be very nice to be able to use bibsnarf with the version of mathscinet at MR lookup.

Posted in Emacs | Tagged , | 3 Comments

Close to numbered macros in LaTeX

I think it is unfortunate that one cannot use numbers in macro names in \LaTeX. Using the xkeyval package, I could obtain something close to it:

\documentclass{article}

\usepackage{xkeyval}

\makeatletter
\define@cmdkey[GRA]{small}{i}{}

\newcommand{\atest}[1]{
  \setkeys[GRA]{small}{#1}%
  \ifcase\cmdGRA@small@i
  \or % i = 1
  A
  \or % i =2
  B
  \or % i =2
  C
  \fi
}
\makeatother

\begin{document}

\atest{i=1} % prints A

\atest{i=2} % prints B

\atest{i=3} % prints C

\end{document}
Posted in LaTeX | Tagged | Leave a comment

Sage 4.7.1 in Ubuntu Oneiric

Since I am starting a clean install of the new Ubuntu, I proceeded to reinstall Sage. After the usual steps, and running sage, I got an error message, which I had not seen before, starting with:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)

/usr/local/share/sage-4.7.1/local/lib/python2.6/site-packages/IPython/ipmaker.pyc in force_import(modname)
     64         reload(sys.modules[modname])
     65     else:
---> 66         __import__(modname)
     67 
     68 

and ending with:

/usr/local/share/sage-4.7.1/local/lib/python2.6/site-packages/numpy/linalg/linalg.py in <module>()
     21         isfinite, size, finfo, absolute, log, exp
     22 from numpy.lib import triu
---> 23 from numpy.linalg import lapack_lite
     24 from numpy.matrixlib.defmatrix import matrix_power
     25 from numpy.compat import asbytes

ImportError: libgfortran.so.3: cannot open shared object file: No such file or directory
Error importing ipy_profile_sage - perhaps you should run %upgrade?
WARNING: Loading of ipy_profile_sage failed.

After some trial and error, I found good keywords to ask google:

sage importerror ubuntu 11.10 libgfortran.so.3

The first result: apt get – How to install gfortran?, from the AskUbuntu site, had the answer: install the package libgfortran3.

Posted in Math | Tagged , | 2 Comments

A simple example

This is my first attempt at using tkz-euclide.

\begin{tikzpicture}
  \tkzDefPoint(0,0){B}
  \tkzDefPoint(8,0){A}
  \tkzDefPoint(7,4){C}
  \tkzDefPoint(1,8){D} 
  \tkzDrawSegment(A,B)
  \tkzDrawSegment(A,C)
  \tkzDrawSegment(C,D)
  \tkzDrawSegment(B,D)
  \tkzDrawSegment(B,C)
  \tkzDrawSegment(A,D)
  \tkzDefMidPoint(C,D)
  \tkzGetPoint{M}
  \tkzInterLL(C,B)(A,D) \tkzGetPoint{P}
  \tkzDrawPoints(A,B,C,D,M,P) 
  \tkzLabelPoints(A,B)
  \tkzLabelPoints[above](C,D)
  \tkzLabelPoints[below](M,P)
  \tkzCentroid(B,P,D)\tkzGetPoint{G}\tkzLabelPoint(G){\Large 4}
  \tkzCentroid(A,P,C)\tkzGetPoint{H}\tkzLabelPoint(H){\Large 1}
  \tkzCentroid(A,P,B)\tkzGetPoint{I}\tkzLabelPoint(I){\Large 2}
\end{tikzpicture}

Posted in LaTeX | Tagged | Leave a comment

Archivos EMALCA

Aquí voy a poner los archivos relativos al curso de Matemáticas discretas que estoy impartiendo en la EMALCA.

Posted in Español | Tagged | Leave a comment

Using naquadah theme in Emacs

I have been using Naquadah theme in Emacs for some time now, and I think it will be a while until I decide to change. I put the following code in my .emacs after requiring it to modify it a little:

(custom-theme-set-faces
 'naquadah
 `(mode-line ((t (:height 0.7 :background "gray20"))))
 `(mode-line-inactive ((t (:height 0.7))))
 `(gnus-header-name ((t (:height 1.2 :bold t :foreground "sky blue"))))
 `(gnus-header-from ((t (:height 1.2 :bold t :foreground "orange3"))))
 `(gnus-header-subject ((t (:height 1.2 :foreground "cyan3"))))
 `(gnus-header-to ((t (:height 1.2))))
 `(gnus-header-date ((t (:height 1.2))))
 `(font-lock-function-name-face ((t (:foreground "MediumOrchid1" :bold t))))
 '(ido-first-match ((t (:foreground "orange" :bold t))))
 '(ido-only-match ((t (:foreground "yellow"))))
 '(ido-subdir ((t (:foreground "magenta1"))))
 '(minibuffer-prompt ((t (:background "magenta4" :foreground "orange1"))))
 )

After this, my Emacs looks like:

Naquadah

Posted in Emacs | Tagged , | Leave a comment

Replacing characters in math mode only

Recently I had to change notation in a LaTeX document: a graph I had named H had now to be named L. The post Replace something in math mode only by Ralf Angeli (from January 2007), helps with that. However the function query-replace-regexp-eval mentioned there, is obsoleted since Emacs 22.1, (or so says C-h f). The following works for me in Emacs 23.2 (requires the function texmathp from AUCTeX):

M-x query-replace-regexp RET H RET \,(if (texmathp) "L" "H") RET

The idea behind it, is that the regular expression H has to be replaced with the result of evaluating (if (texmathp) "L" "H"), which is L inside math mode and H not inside math mode.

Note that after the last RET, the first question can be answered ! to make all replacements without further questions.

Posted in Emacs | Tagged , , , | Leave a comment