- Go to TikZ Build to find out the latest built version for TikZ.
- Download the tar package and extract it to some temporary place.
ls pgfCVS2010-07-25_TDS.zip
mkdir pgfInstallFile
unzip pgfCVS2010-07-25_TDS.zip -d pgfInstallFile/
doc/ tex/ - Go to /usr/share/texmf/tex/
- You have to replace the old pgf package file with the new file. You can copy
cp -r $pgfInstallFile/tex/context/pgf/ /usr/share/texmf/tex/context/pgf/ ;
cp -r $pgfInstallFile/tex/generic/pgf/ /usr/share/texmf/tex/generic/pgf/ ;
cp -r $pgfInstallFile/tex/latex/pgf/ /usr/share/texmf/tex/latex/pgf/ ;
cp -r $pgfInstallFile/tex/plain/pgf/ /usr/share/texmf/tex/plain/pgf/ ; - After that, you can update the tex file configuration,
texhash ;
Sunday, September 26, 2010
How to update TikZ library
Sometime you need to update your TikZ library to contain new library files. Then you can do like this,
Thursday, July 22, 2010
Install a Latex style file on Linux
Take bbding as an example.
$ wget http://www.tug.org/texlive/Contents/live/texmf-dist/tex/latex/bbding/bbding.sty # Get the style file from web site.
$ mkdir /usr/share/texmf/tex/latex/bbding # Make a directory for bbding
$ cp bbding.sty /usr/share/texmf/tex/latex/bbding # Copy bbding style file to this directory.
$ texhash # Update linux configuration
Sunday, March 21, 2010
Tips for Latex usage
- Tips and tricks for Latex
(TeX, LaTeX, BibTeX and friends, are a constant source of joy and frustration. This growing collection of tips and tricks is an attempt to document some of the things I have learned working with these wonderful tools. This page is just one of many similar LaTeX tips and tricks pages on the net. Hopefully you'll find something useful here.)
Monday, March 8, 2010
How to prevent memory leak in C plusplus
- 'delete' all variables defined by 'new'
Unless you know what you are doing, you have to delete any variables which are defined by 'new'. so that you free the same memory you allocated.
char* str = new char [30];
delete [] str; - Watch those pointer assignments
Every dynamic variable (allocated memory on the heap) needs to be associated with a pointer. When a dynamic variable becomes disassociated from its pointer(s), it becomes impossible to erase. Again, this results in a memory leak.
char* str1 = new char [30];
char* str2 = new char [40];
strcpy(str1, "Memory leak");
str2 = str1; // Bad! Now the 40 bytes are impossible to free.
delete [] str2; // This deletes the 30 bytes.
delete [] str1; // Possible access violation. - Be careful with local pointers
A pointer you declare in a function is allocated on the stack, but the dynamic variable it points to is allocated on the heap. If you don't delete it, it will persist after the program exits from the function.
void Leak(int x){
char* p = new char [x];
// delete [] p; // Remove the first comment marking to correct.
} - Pay attention to the square braces after "delete"
Use "delete" by itself to free a single object. Use "delete" [] with square brackets to free a heap array. Don't do something like this
char* one = new char;
delete [] one; // Wrong
char* many = new char [30];
delete many; // Wrong!
Learning Cpp -- When to use 'new' -- Stack or Heap
Use new to define large large chunks of dataMore typically, you use new with larger chunks of data, such as arrays, strings, and structures. This is where new is useful. Suppose, for ample, you’re writing a program that might or might not need an array, ending on information given to the program while it is running. If you create an array by declaring it, the space is allocated when the program is compiled. Whether or not the program finally uses the array, the array is there, using up memory. Allocating the array during compile time is called static binding, meaning that the array is built in to the program at compile time. But with new, you can create an array during runtime if you need it and skip creating the array if you don’t need it.Or you can select an array size after the program is running. This is called dynamic binding, meaning that the array is created while the program is running. Such an array is called a dynamic array. With static binding, you must specify the array size when you write the program. With dynamic binding, the program can decide on an array size while the program runs.
Thursday, March 4, 2010
use .emacs to configure emacs
My .emacs file
(setq frame-title-format
(concat "%b - emacs@" (system-name)))
;; default to unified diffs
(setq diff-switches "-u")
;; always end a file with a newline
(setq require-final-newline nil)
;;(put 'set-goal-column 'disabled nil)
;; ====================
(setq inhibit-default-init t)
(setq inhibit-startup-message t)
(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(auto-compression-mode t nil (jka-compr))
'(case-fold-search t)
'(current-language-environment "UTF-8")
'(default-input-method "rfc1345")
'(global-font-lock-mode t nil (font-lock)))
(when window-system
;; enable wheelmouse support by default
(mwheel-install)
;; make switching frames works properly under the default click-to-focus
(setq focus-follows-mouse nil))
use Xdefaults to configure emacs
- Create a new .Xdefaults file in your home directory. This file can be used to configure your emacs.
Emacs.Font: fontset-courier
Emacs.Fontset-0:-*-courier-medium-r-normal-*-18-*-*-*-*-*-fontset-courier,\
emacs.geometry:90x60+200+200
emacsp.background:gray75
Emacs.foreground: gray
Emacs.background: black
Then you can do this to make it work.
xrdb .Xdefaults
Subscribe to:
Posts (Atom)