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 , | 1 Comment

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