* Useful color themes for beamer (\usecolortheme{...}):
albatross, beetle, crane, dolphin, dove, fly, lily, orchid, rose, seagull, seahorse, whale.
* Problem with the "babel" package in TeXLive.
\usepackage[spanish]{babel}
Option clash for package babel. \usepackage
The package "hyphen-Spanish" must be installed, to do this type in terminal:
felipe@dagobah:~$ sudo apt-get install texlive-lang-spanish
* Changing the line spacing:
\baselinestretch{2.0}
The argument is the scale factor. In the above example, a double-spaced was established.
* Installing the "mnsymbol" package.
Download mnsymbol.zip (http://www.ctan.org/tex-archive/fonts/mnsymbol/).
felipe@dagobah:~/Downloads$ unzip mnsymbol.zip
felipe@dagobah:~/Downloads$ cd mnsymbol/tex/
felipe@dagobah:~/Downloads/mnsymbol/tex$ latex MnSymbol.ins
felipe@dagobah:~/Downloads/mnsymbol/tex$ sudo mkdir -p /usr/share/texmf-texlive/tex/latex/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol/tex$ sudo mkdir -p /usr/share/texmf-texlive/fonts/source/public/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol/tex$ sudo mkdir -p /usr/share/texmf-texlive/doc/latex/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol/tex$ sudo cp MnSymbol.sty /usr/share/texmf-texlive/tex/latex/MnSymbol/MnSymbol.sty
felipe@dagobah:~/Downloads/mnsymbol/tex$ cd ..
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp source/* /usr/share/texmf-texlive/fonts/source/public/MnSymbol/
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp MnSymbol.pdf README /usr/share/texmf-texlive/doc/latex/MnSymbol/
felipe@dagobah:~/Downloads/mnsymbol$ sudo mkdir -p /usr/share/texmf-texlive/fonts/map/dvips/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo mkdir -p /usr/share/texmf-texlive/fonts/enc/dvips/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo mkdir -p /usr/share/texmf-texlive/fonts/type1/public/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo mkdir -p /usr/share/texmf-texlive/fonts/tfm/public/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp enc/MnSymbol.map /usr/share/texmf-texlive/fonts/map/dvips/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp enc/*.enc /usr/share/texmf-texlive/fonts/enc/dvips/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp pfb/*.pfb /usr/share/texmf-texlive/fonts/type1/public/MnSymbol
felipe@dagobah:~/Downloads/mnsymbol$ sudo cp tfm/* /usr/share/texmf-texlive/fonts/tfm/public/MnSymbol
Regenerate the indexes and enable MnSymbol:
felipe@dagobah:~$ sudo mktexlsr
felipe@dagobah:~$ sudo updmap-sys --enable MixedMap MnSymbol.map
Now, the following code can be compiled:
\documentclass{report}
\usepackage{MnSymbol}
\begin{document}
$\int_V \sigma \delta\epsilon dV$
\end{document}
* Mixing one-column and two-column for figures and tables.
\begin{table*} ... \end{table*}
\begin{figure*} ... \end{figure*}
* Inverse and forward search in Kile editor, follow the following steps in order to enable this option for DVI docs:
"Settings -> Configure Kile".
Click "Tools -> Build -> LaTeX".
Select the "Modern" configuration.
Clear and set the options to: -interaction=nonstopmode -src %source.
Click "ForwardDVI" in the list, and select the "Embedded Viewer" configuration.
Click OK.
Click "LaTeX" in the build toolbar menu, and click "ForwardDVI" in the view toolbar menu.
Open "Settings -> Configure Kile".
Click "DVI Specials".
Select Kile as the editor.
Click OK.
Some Notes
Sep 12, 2010
Aug 20, 2010
MATLAB notes.
* Adjusting a MATLAB image to full size page and export it as a .pdf file (for a known X,Y,Z vectors, in this case, velocity values measured in laboratory):
>> figure;
pcolor(X,Y,Z);
grid; hold on; shading interp;
colorbar; colormap('jet');
contour(X,Y,Z,12,'k');
title('Isotach curves','FontSize',15)
xlabel('Width of the section (m)','FontSize',12)
ylabel('Heigth of the section (m)','FontSize',12)
axis equal tight
>> orient landscape
>> print -dpdf Isotach_curves.pdf
* Exporting data vectors from MATLAB to text files (for T and Sa vectors):
>> dlmwrite('spectrum.txt', T, 'delimiter', '\t', 'precision', 6)
>> dlmwrite('spectrum.txt', Sa, '-append', 'delimiter', '\t',... 'precision', 6)
* Evaluating a symbolic expression in MATLAB (subs(...)). Try this code in which I made a simple implementation of the inverse transform method to generate continuous RV of a given PDF:
syms x Fxx;
lambda = 0.5;
fx = lambda*exp(-lambda*x); % Desired PDF
Fx = int(fx,x); % CDF
n = 1e5; % Number of random numbers
U = rand(1,n); % RN Uniformly distributed 0-1
fun = Fx-Fxx;
X = solve(fun,x);
Fxx = U;
RN = real(subs(X));
figure;
hist(RN,ceil(sqrt(n-1)));
>> figure;
pcolor(X,Y,Z);
grid; hold on; shading interp;
colorbar; colormap('jet');
contour(X,Y,Z,12,'k');
title('Isotach curves','FontSize',15)
xlabel('Width of the section (m)','FontSize',12)
ylabel('Heigth of the section (m)','FontSize',12)
axis equal tight
>> orient landscape
>> print -dpdf Isotach_curves.pdf
* Exporting data vectors from MATLAB to text files (for T and Sa vectors):
>> dlmwrite('spectrum.txt', T, 'delimiter', '\t', 'precision', 6)
>> dlmwrite('spectrum.txt', Sa, '-append', 'delimiter', '\t',... 'precision', 6)
* Evaluating a symbolic expression in MATLAB (subs(...)). Try this code in which I made a simple implementation of the inverse transform method to generate continuous RV of a given PDF:
syms x Fxx;
lambda = 0.5;
fx = lambda*exp(-lambda*x); % Desired PDF
Fx = int(fx,x); % CDF
n = 1e5; % Number of random numbers
U = rand(1,n); % RN Uniformly distributed 0-1
fun = Fx-Fxx;
X = solve(fun,x);
Fxx = U;
RN = real(subs(X));
figure;
hist(RN,ceil(sqrt(n-1)));
Jun 15, 2010
Links to some of my interests.
* My favorite comic strips:
http://www.latex-community.org/forum/
http://www.mathworks.com/matlabcentral/fileexchange/?term=felipe+uribe
GNU/Linux notes.
* Useful terminal commands:
-- mplayer videoname.avi -dumpaudio -dumpfile audioname.mp3 : extract audio from .avi file
-- convert -sample 100×50 oldimagename.jpg newimagename.jpg : resize an image
-- split -b 2m oldfilename newfilename : split a file into several parts
-- sudo apt-get autoclean : delete unnecessary files
-- sudo apt-get autoremove : clean unnecessary packages or with errors
* Accessing your Windows partition from GNU/Linux:
1. Mount the windows partition (ntfs): open a terminal as root
felipe@dagobah:~$ su
2. Create the destination folder:
root@dagobah:/home/felipe# mkdir /mnt/windows_C
3. Edit the fstab file:
root@dagobah:/home/felipe# joe /etc/fstab
5. Save the file (ctrl+k+x) and run the console command:
root@dagobah:/home/felipe# mount /dev/sda1
Finally, simply open the folder /mnt/windows_C to see your windows files corresponding to the sda1 partition.
* "kill" command to stop CPU processes:
First, use the ps command to find out the process ID (called PID).
felipe@dagobah:~$ ps aux | grep processname
After doing that we obtain the PID, e.g. 3316. Finally, kill the process using its PID with the kill command (kill [ -signal | -s signal ] pid),
felipe@dagobah:~$ kill -9 3316
* Using ssh to run MATLAB programs on another computer. First, we access the remote machine, for this we must have an account with the username (in this case fuc) and the IP address of the machine (for example 123.145.267.289); -X enables X11 forwarding.
felipe@dagobah:~$ ssh fuc@123.145.267.289 -X
fuc@123.145.267.289's password:
then appears on console,
Last login: Mon Nov 21 07:54:53 2011 from 123.145.36.78
[fuc@localhost ~]$
Now, we use GNU Screen to connect and reconnect using different terminal types, allowing applications to continue running (in this case MATLAB), without using our computer at home.
[fuc@localhost ~]$ screen
Then, we create different consoles, press Ctrl+a then c (create), press Ctrl+a then " (view all the shell sessions created), press Ctrl+a then A (change the name of the session), etc., (see http://www.debian-administration.org/articles/34 for more information). For example, I created three sessions, the first with name MATLAB (in which I run the program), another with name of htop (in which I leave open htop to observe the processes of the computer) and another with the name of the program (in which I open the program in a text editor to make the necessary changes). Then, we copy the files to the machine using scp, it is necessary to open another shell sesion in our pc, for example,
felipe@dagobah:~$ scp -r /home/felipe/Documents/MATLAB/thesis/Subset_simulation/subsim_paper_examples/ex_8_2/ fuc@123.145.267.289:/home/fuc/
* Accessing your Windows partition from GNU/Linux:
1. Mount the windows partition (ntfs): open a terminal as root
felipe@dagobah:~$ su
Password:
root@dagobah:/home/felipe# mkdir /mnt/windows_C
3. Edit the fstab file:
root@dagobah:/home/felipe# joe /etc/fstab
4. Add the following line to the end of the file (replace /dev/sda1 with the partition where you have installed windows, sda1 in my case):
/dev/sda1 /mnt/windows_C ntfs defaults 0 05. Save the file (ctrl+k+x) and run the console command:
root@dagobah:/home/felipe# mount /dev/sda1
Finally, simply open the folder /mnt/windows_C to see your windows files corresponding to the sda1 partition.
* "kill" command to stop CPU processes:
First, use the ps command to find out the process ID (called PID).
felipe@dagobah:~$ ps aux | grep processname
After doing that we obtain the PID, e.g. 3316. Finally, kill the process using its PID with the kill command (kill [ -signal | -s signal ] pid),
felipe@dagobah:~$ kill -9 3316
* Using google translator from the terminal:
felipe@dagobah:~$ sudo aptitude install lynx
Download the script of the translator:
http://pastie.org/pastes/1137300/download
felipe@dagobah:~$ cd Downloads
felipe@dagobah:~$ cp pastie-1137300.sh /usr/bin
felipe@dagobah:~$ sudo chmod +x /usr/bin/pastie-1137300.sh
felipe@dagobah:~$ sudo mv "pastie-1137300.sh" "Google_Translator"
And finally use it:
felipe@dagobah:~$Google_Translator "bonjour monsieur, vous allez bien" fr en
* Formatting the USB using the terminal:
felipe@dagobah:~$ sudo -s
root@dagobah:/home/felipe# mount
Check the name of your device in my case is "sdb1", and use:
root@dagobah:/home/felipe# umount /dev/sdb1
root@dagobah:/home/felipe# mkfs.vfat -I /dev/sdb1
Then reconnect the USB, and check the available space with:
felipe@dagobah:~$ df -h
* Listening to music from the console:
felipe@dagobah:~$ sudo apt-get install mpg123
When the folders or mp3 songs have blank spaces, we have to put it in quotes. To play one song,
felipe@dagobah:~$ mpg123 path/songname.mp3
To play all the songs in a folder in order, (use ctrl+c to change songs):
felipe@dagobah:~$ mpg123 path/foldername/*
felipe@dagobah:~$ sudo apt-get install sam2p
Now go to the path where the image is located and type in terminal:
felipe@dagobah:~/Documents/TEXT$ sam2p filename.png EPS: newfilename.eps
* The shutdown icon in Ubuntu Gnome disappeared, I solved this problem as follows:
Right click on panel and select "add to panel", then find the icon "indicator applet session" and place it on the panel again.
* Problem with root and Xserver:
felipe@dagobah:~$ su
Password:
root@dagobah:/home/felipe# kate /etc/sudoers
No protocol specified
kate: cannot connect to X server :0.0
Solution, execute "kdesu",
felipe@dagobah:~$ kdesu kate /etc/sudoers
Or we can activate the access control which allows any host to access our X server:
felipe@dagobah:~$ xhost +local:
* Edit the sudoers file for user privileges:
felipe@dagobah:~$ su
Password:
root@dagobah:/home/felipe# EDITOR="emacs" visudo
And create a new user below the line where appears "root ALL(ALL) ALL" in the same way,
"felipe ALL(ALL) ALL"
felipe@dagobah:~$ sudo aptitude install lynx
Download the script of the translator:
http://pastie.org/pastes/1137300/download
felipe@dagobah:~$ cd Downloads
felipe@dagobah:~$ cp pastie-1137300.sh /usr/bin
felipe@dagobah:~$ sudo chmod +x /usr/bin/pastie-1137300.sh
felipe@dagobah:~$ sudo mv "pastie-1137300.sh" "Google_Translator"
And finally use it:
felipe@dagobah:~$Google_Translator "bonjour monsieur, vous allez bien" fr en
felipe@dagobah:~$ sudo -s
root@dagobah:/home/felipe# mount
Check the name of your device in my case is "sdb1", and use:
root@dagobah:/home/felipe# umount /dev/sdb1
root@dagobah:/home/felipe# mkfs.vfat -I /dev/sdb1
Then reconnect the USB, and check the available space with:
felipe@dagobah:~$ df -h
* Listening to music from the console:
felipe@dagobah:~$ sudo apt-get install mpg123
When the folders or mp3 songs have blank spaces, we have to put it in quotes. To play one song,
felipe@dagobah:~$ mpg123 path/songname.mp3
To play all the songs in a folder in order, (use ctrl+c to change songs):
felipe@dagobah:~$ mpg123 path/foldername/*
For randomly played songs, we have to add after the path "-z".
* LaTeX does not work well with most of the popular image formats such as .JPG, .BMP, .PNG or .GIF. It does like encapsulated postscript images. So, if we want nice figures in our documents, we can either use tools that can generate .EPS files. There are lots of ways, but I opted for using sam2p, a small application that converts images in different formats.felipe@dagobah:~$ sudo apt-get install sam2p
Now go to the path where the image is located and type in terminal:
felipe@dagobah:~/Documents/TEXT$ sam2p filename.png EPS: newfilename.eps
* The shutdown icon in Ubuntu Gnome disappeared, I solved this problem as follows:
Right click on panel and select "add to panel", then find the icon "indicator applet session" and place it on the panel again.
* Problem with root and Xserver:
felipe@dagobah:~$ su
Password:
root@dagobah:/home/felipe# kate /etc/sudoers
No protocol specified
kate: cannot connect to X server :0.0
Solution, execute "kdesu",
felipe@dagobah:~$ kdesu kate /etc/sudoers
Or we can activate the access control which allows any host to access our X server:
felipe@dagobah:~$ xhost +local:
* Edit the sudoers file for user privileges:
felipe@dagobah:~$ su
Password:
root@dagobah:/home/felipe# EDITOR="emacs" visudo
And create a new user below the line where appears "root ALL(ALL) ALL" in the same way,
"felipe ALL(ALL) ALL"
* Editing the menu.lst file:
felipe@dagobah:/$ cd /boot/grub/
felipe@dagobah:/$ cd /boot/grub/
felipe@dagobah:/boot/grub$ sudo kate menu.lst
felipe@dagobah:~$ ssh fuc@123.145.267.289 -X
fuc@123.145.267.289's password:
then appears on console,
Last login: Mon Nov 21 07:54:53 2011 from 123.145.36.78
[fuc@localhost ~]$
Now, we use GNU Screen to connect and reconnect using different terminal types, allowing applications to continue running (in this case MATLAB), without using our computer at home.
[fuc@localhost ~]$ screen
Then, we create different consoles, press Ctrl+a then c (create), press Ctrl+a then " (view all the shell sessions created), press Ctrl+a then A (change the name of the session), etc., (see http://www.debian-administration.org/articles/34 for more information). For example, I created three sessions, the first with name MATLAB (in which I run the program), another with name of htop (in which I leave open htop to observe the processes of the computer) and another with the name of the program (in which I open the program in a text editor to make the necessary changes). Then, we copy the files to the machine using scp, it is necessary to open another shell sesion in our pc, for example,
felipe@dagobah:~$ scp -r /home/felipe/Documents/MATLAB/thesis/Subset_simulation/subsim_paper_examples/ex_8_2/ fuc@123.145.267.289:/home/fuc/
With the files on the remote machine, we run MATLAB in the corresponding screen session,
[fuc@localhost ~]$ /usr/local/matlab/R2011a/bin/matlab -nodesktop
And finally we run the target program (in my case, an implementation of monte carlo and subset simulation methods for reliability analysis in structural dynamics),
>> SubSim_ex_8_2
[fuc@localhost ~]$ /usr/local/matlab/R2011a/bin/matlab -nodesktop
And finally we run the target program (in my case, an implementation of monte carlo and subset simulation methods for reliability analysis in structural dynamics),
>> SubSim_ex_8_2
When we go out of the screen sessions, it is necessary press Ctrl+a then d (detach from the session), this is very important, since the processes that we carried out may be lost. After doing that, we can safely get out of our console and turn off our computer, whereas the remote machine is executing the necessary calculations.
To reconnect and review the processes on the remote machine, we enter again to the remote machine as shown in the first step, and type in the console screen -ls,
[fuc@localhost ~]$ screen -ls
There are screens on:
23407.pts-6.localhost (Detached)
1 Sockets in /home/fuc/tmp
To reconnect and review the processes on the remote machine, we enter again to the remote machine as shown in the first step, and type in the console screen -ls,
[fuc@localhost ~]$ screen -ls
There are screens on:
23407.pts-6.localhost (Detached)
1 Sockets in /home/fuc/tmp
and we access to the session that appears with
[fuc@localhost ~]$ screen -r 23407
In this way, we can reconnect to our screen session and observe the process that we had executed. Remember press Ctrl+a then d, when we go out of the screen session. Finally, when the program has finished, we can copy the output files to our pc,
felipe@dagobah:~$ scp fuc@123.145.267.289:/home/fuc/*.txt /home/felipe/Desktop/
* Installing MATLAB R2010a in GNU/Linux (Ubuntu 10.10, Mandriva 2010, Mepis 11.0, Debian 6.0 & Slackware 13.37):
* Installing COMSOL 4.0 in GNU/Linux:
[fuc@localhost ~]$ screen -r 23407
In this way, we can reconnect to our screen session and observe the process that we had executed. Remember press Ctrl+a then d, when we go out of the screen session. Finally, when the program has finished, we can copy the output files to our pc,
felipe@dagobah:~$ scp fuc@123.145.267.289:/home/fuc/*.txt /home/felipe/Desktop/
- Install the libXp-devel package. See http://www.apt-get.co.uk/apt_get_libxp-dev.html. Aditionally, in new MATLAB versions the following information must be taken into account:http://www.mathworks.com/support/compilers/R2012b/glnxa64.html
- Open a terminal and type, mkdir -p /home/felipe/cdmatlab (where cdmatlab is the folder that I have created). This command create a new directory that will serve as a temporary workspace.
- Then, we have to go to the directory where we have the image of the installer (Type in the terminal: cd /media/cdrom).
- In the terminal, type, sudo mount -o loop matlab2010a.iso /home/felipe/cdmatlab. This command mount the .iso image that contain the MATLAB installer, and put the installer in our temporary workspace.
- Go to the temporary folder that you had created in the first step (Type in the terminal, cd /home/felipe/cdmatlab).
- Type the next command (With quotes): sudo '/home/felipe/cdmatlab/install'.
- Appears the 'Mathworks installer'. Here, click in: 'Install manually without using the Internet', accept the license.
- Then, you can modify the root folder where MATLAB is going to be installed. Recommendation: Install MATLAB in the next directory: /usr/local/matlabR2010a the installer will create the folder automatically.
- Copy the serial that we have in our CD, in the folder crack, the archive: install.txt.
- Select the architecture that your computer support (X86 or X86-64) and click in OK, and start the installation.
- After the installation process finishes, you have to provide the License file, that is located in: /home/felipe/cdmatlab/crack. There, you select the archive: lic_standalone.dat and click in next.
- DON'T START MATLAB... Deactivate the check box, and then click finish.
- Now is time to create the 'Executable archive' that will let us to work with MATLAB in Linux.
- Type in the teminal (with quotes): sudo '/usr/local/matlabR2010a/install_matlab'
- Now you have to install MATLAB from the terminal, type y and press Enter.
- Type y and press Enter...Again....Again....Again.
- Now the terminal prompt if the MATLAB access directory is: /usr/local/bin, press 'Enter' (I'm not going to change that path).
- Type y and press Enter.
- Now you have to put the application 'MATLAB' in the menu 'Applications', so right-click to 'Applications' (In the menu bar), and click in 'Edit menus'.
- Go to 'Programming' or 'Development' and click in 'New Item'.
- Appears a window where you put the next words: *Name: MATLAB R2010a, *Command: matlab -desktop -np.
- If you want, you can download an image of MATLAB's logo, and put it on the next folder: /usr/local/bin/imagename. Then in the window where you add MATLAB to the menu, I mean: right-click Applications-->Programming... Select MATLAB from the list and then click on 'Properties', click on the image of the window and search the archive that you've downloaded and click in 'close'.
- The last thing that you have to do is 'unmount' the image that you've mounted before (At the beggining). So, in terminal go to the folder (cd /home/felipe) and type: sudo umount cdmatlab.
- Go to the directory that contains the COMSOL CD: cd /media/COMSOL40
- In the terminal type (With the quotes): sudo '/media/COMSOL40/setup'
- Appears the COMSOL 4.0 installer... Click in 'New COMSOL 4.0 installation'
- Accept the license agreement and search the license file that is in: /media/COMSOL40/SPYRAL, choose the 'nodelocked-license.dat' because is the one that we can use (Stand-alone installation)... Click next.
- Select your architecture (32-bits, 64-bits)... Click next.
- Select 'Full installation', then click in next.
- Search the 'Matlab installer root' (If you have one installed in your PC)... In my case I have the next direction to the Matlab root directory: /usr/local/matlabR2010a, then click next.
- Click in 'Install'... Wait some minutes until the Installer finishes the process.
- Now you have to put the application 'Comsol 4.0' in the menu 'Applications', so right-click to 'Applications' (In the menu bar), and click in 'Edit menus'.
- Go to 'Science' and click in 'New Item'.
- Appears a window where you put the name: Comsol Multiphysics 4.0 and the command: /usr/local/comsol40/bin/comsol -3drend sw -np 2 -desktop
Subscribe to:
Posts (Atom)