Feeds:
Posts
Comments

Posts Tagged ‘Command’


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 »


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-dcraw                      - GIMP plug-in for loading RAW digital photo
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 »


If you have programmed in Python, perhaps you would know IPython.

IPython is an interactive shell for python programming.

Installing IPython

In the terminal (Ctrl+Alt+T), run the command line

$ sudo apt-get install -y ipython ipython-notebook

and after entering your sudo password, IPython will be installed.

Command to install IPython

Command to install IPython

Running IPython

In the terminal, launch the command

$ ipython
Command to Call the Ipython session

Command to Call the Ipython session

and you will have you session running.

Initial Ipython session

Initial Ipython session

More about IPython in a next post!!! (specially about the notebook) 😉

Cheers, and enjoy life!

Read Full Post »


The command xarg is used to pass the standard output (of a previous command) as standard input to the following.

Worked Example

I want to delete all files in the current directory containing numbers in their names.

First, let me show you the list of files!!!

$ ls
calchep.rc   func1.mdl    lgrng1.mdl  lhep.rc       prtcls15.mdl  
prtcls4.mdl  qed.mdl       smnlg.mdl   uedqed.mdl  vars15.mdl  vars4.mdl
calchep.rc~  func2.mdl    lgrng2.mdl  newsm.mdl     prtcls1.mdl   
qcd.mdl      qed.mdl~      smren.mdl   ufo.rc      vars1.mdl
feynarts.rc  func4.mdl    lgrng2.tex  project.mdl   prtcls2.mdl   
qcd.mdl~     slhaplus.mdl  sm_tex.mdl  ufo-static  vars2.mdl
func15.mdl   lgrng15.mdl  lgrng4.mdl  project.mdl~  prtcls2.tex   
qeddip.mdl   sm_brst.mdl   stand.mdl   ug.out      vars2.tex

What a mess!!! I can use the grep command to show the files whose names have (at least a number)

$ ls | grep [0-9]
func15.mdl
func1.mdl
func2.mdl
func4.mdl
lgrng15.mdl
lgrng1.mdl
lgrng2.aux
lgrng2.log
lgrng2.mdl
lgrng2.pdf
lgrng2.tex
lgrng4.mdl
prtcls15.mdl
prtcls1.mdl
prtcls2.mdl
prtcls2.tex
prtcls4.mdl
vars15.mdl
vars1.mdl
vars2.mdl
vars2.tex
vars4.mdl

Finally, I would like to remove all these files, using rm command… I guess you’ll try something like

$ ls | grep [0-9] | rm 
rm: missing operand
Try 'rm --help' for more information.

Wrong!!! (bad luck for me)… the right answer is that the list should be pass like arguments to the command rm. Therefore, by doing

$ ls | grep [0-9] | xargs rm
$ ls
calchep.rc   project.mdl~  slhaplus.mdl  uedqed.mdl
calchep.rc~  qcd.mdl       sm_brst.mdl   ufo.rc
feynarts.rc  qcd.mdl~      smnlg.mdl     ufo-static
lhep.rc      qeddip.mdl    smren.mdl     ug.out
newsm.mdl    qed.mdl       sm_tex.mdl
project.mdl  qed.mdl~      stand.mdl

the job is done!!!

Cheers.

Enjoy.

Read Full Post »


If for any reason you need to un-install Mathematica,  you should delete the files associated to it. If the installation was the usual one, follow the below steps.

$ cd /usr/local
$ sudo rm -r Wolfram
$ cd bin
$ sudo rm math mathematica Mathematica MathKernel mcc
$ cd ../../share
$ sudo rm -r Mathematica

This would be enough.

Enjoy!

Read Full Post »

Older Posts »