Saturday, April 13, 2013

Texlive and CJK

  1. suppose texlive and CJK is installed correctly
  2. install fontforge
    sudo apt-get install fontforge
    
  3. download font.tar.bz2
  4. prepare font song.ttc, and generate font files
    fontforge -script subfonts.pe simsun.ttc song Unicode.sfd
    
  5. create bash script makemap.sh, run the script to generate map file
    if [ -f song.map ]; then
        rm song.map
    fi
    for i in *.tfm
    do
        echo "${i%.tfm} ${i%.tfm} <${i%.tfm}.pfb" >> song.map
    done
    
  6. create c70song.fd
    % This is c70song.fd for CJK package.
    % created by Edward G.J. Lee
    % modify by Yue Wang
    \ProvidesFile{c70song.fd}
    \DeclareFontFamily{C70}{song}{\hyphenchar \font\m@ne}
    \DeclareFontShape{C70}{song}{m}{n}{<-> CJK * song}{}
    \DeclareFontShape{C70}{song}{bx}{n}{<-> CJKb * song}{\CJKbold}
    \endinput
    
  7. check system conf file location
    kpsewhich texmf.cnf
    
  8. change TEXMFHOME to
    TEXMFHOME = $HOME/texmf
    
  9. change TEXMFDBS to
    TEXMFDBS = $TEXMFHOME;$TEXMFLOCAL;$TEXMFMAIN;$VARTEXFONTS;$TEXMFSYSVAR;$TEXMFDIST
    
  10. mimic texmf tree and copy fonts and configs. texmf should match those in TEXMFHOME
    mkdir -p ~/texmf/fonts/map/dvips/CJK
    mkdir -p ~/texmf/fonts/tfm/CJK/song
    mkdir -p ~/texmf/fonts/type1/CJK/song
    mkdir -p ~/texmf/tex/latex/CJK/UTF8
    
    cp song.map   ~/texmf/fonts/map/dvips/CJK
    cp *.tfm      ~/texmf/fonts/tfm/CJK/song
    cp *.pfb      ~/texmf/fonts/type1/CJK/song
    cp c70song.fd ~/texmf/tex/latex/CJK/UTF8
    
  11. update system conf
    sudo texhash
    updmap
    
  12. in $HOME/texmf/fonts/map/pdftex/updmap/pdftex.map, append content in song.map

Wednesday, April 10, 2013

How to adjust height of an old Steelcase chair (454311M)?

The chairs do not have the pneumatic mechanism to adjust the height of the chair. The height is adjusted by turning the chair in circles around the base. The base post contains a screw mechanism that gives 2-3″ of adjustment.

Tuesday, April 9, 2013

Bash IO redirection

> filename
>> filename
1> filename
1>> filename
2> filename
2>> filename
&> filename
2>> &1

Monday, March 11, 2013

Cygwin SSH tip


if you use ssh-keygen to generate public key, use ssh-copy-id, and get the following msg while logging in remote device,
permission for id_rsa are too open
try
1. cd .ssh
2. chmod 600 id_rsa known_hosts

if you can not change the permission of id_rsa, try
1. chgrp -r Users id_rsa
2. chmod 600 id_rsa

if you define hostname aliases in SSH config, and get msg
Bad owner or permissions on /home/[username]/.ssh/config
try
1. chgrp -r Users config
2. chmod 600 config

Friday, February 22, 2013

Mount Nikon D5100 on Ubuntu 12.10


0. install gphoto2 

1. lsusb

Bus 001 Device 003: ID 046d:c31c Logitech, Inc. Keyboard K120 for Business
Bus 002 Device 007: ID 04b0:0429 Nikon Corp.
Bus 002 Device 003: ID 03f0:a407 Hewlett-Packard
Bus 002 Device 004: ID 03f0:0d17 Hewlett-Packard LaserJet 1012


2. gvfs-mount "gphoto2://[usb,002,007]", with quotes
    002 is the Bus number, 007 is the Device number

3. check /run/user/[username]/gvfs or ~/.gvfs

Monday, February 18, 2013

How to install Fcitx on Kubuntu

  1. sudo apt-get install fcitx kde-config-fcitx fcitx-ui-classic fcitx-googlepinyin
  2. im-switch -s fcitx -z default
  3. fcitx -r
  4. run qtconfig, in "Interface", choose "Default Input Method" to "fcitx"