Search Results for 'latex' ↓

XeTeX 与 Emacs Notes Mode

Emacs rules.

我用 Emacs 写 Wiki做计划,也用它作笔记。当然了,偶尔也用它玩俄罗斯方块。最近用 Notes Mode 作笔记时有个麻烦,就是 notes mode 不支持生成中文的PDF文件。可 Mac 上却有个如此方便XeTeX 来用,不能看中文实在不爽。我就把生成PDF的脚本文件-parsenotes 作了些简单修改来满足中文需求。下面就是我修改后的 parsenotes(你也可以点击这里下载)。

Continue reading →

my .emacs

I’m using AquaEmacs with Emacs-Wiki (EmacsWiki中文FAQ)

(setq user-full-name "Wen Zhang")
(setq user-mail-address "wwzhang@gmail.com")
(set-language-environment "Chinese-GB")
(prefer-coding-system 'utf-8)
;;TAB
(setq-default indent-tabs-mode nil)
(setq default-tab-width 8)
(setq tab-stop-list ())
(loop for x downfrom 40 to 1 do
      (setq tab-stop-list (cons (* x 4) tab-stop-list)))
;;sentence and Chinese
(setq sentence-end "\\([。!?]\\|……\\|[.?!][]\"')}]*\\($\\|[ \t]\\)\\)[ \t\n]*")

(add-to-list 'load-path "~/elisp/emacs-wiki") ;;load-path
(add-to-list 'load-path "~/elisp/")

;;(require 'gnuserv)
;;(gnuserv-start)

(setq mac-option-modifier 'meta) ;;Sets the alt/opetion key as Meta

;;use safari
;;(setq browse-url-browser-function 'browse-url-safari)
;;  (defun browse-url-safari (url &optional new-window)
;;   "Open URL in a new Safari window."
;;   (interactive (browse-url-interactive-arg "URL: "))
;;   (unless
;;       (string= ""
;;             (shell-command-to-string
;;              (concat "open -a Safari " url)))
;;     (message "Starting Safari...")
;;     (start-process (concat "open -a Safari " url) nil "open -a Safari " url)
;;     (message "Starting Safari... done")))
;;  (defun report-emacs-bug-externally-p () t)

;;Transparency

;;(modify-frame-parameters (selected-frame) '((active-alpha . 0.8)))
;;(modify-frame-parameters (selected-frame) '((inactive-alpha . 0.4)))

;;emacs-wiki
(require 'emacs-wiki)
;;(require 'emacs-wiki-menu)
(require 'emacs-wiki-table) 

(setq emacs-wiki-publishing-directory "~/Sites/Wikiwiki")
(setq emacs-wiki-maintainer "mailto:wwzhang@gmail.com")
(setq emacs-wiki-directories '("~/emacs/WiKi"))
(setq emacs-wiki-meta-charset "gb2312")

(defun sacha-emacs-wiki-auto-publish ()
  (when (derived-mode-p 'emacs-wiki-mode)
    (unless emacs-wiki-publishing-p
      (let ((emacs-wiki-publishing-p t)
            (emacs-wiki-after-wiki-publish-hook nil))
  (emacs-wiki-publish-this-page)))))

(add-hook 'emacs-wiki-mode-hook
  (lambda () (add-hook 'after-save-hook 'sacha-emacs-wiki-auto-publish nil t)))

(setq emacs-wiki-style-sheet "
")
(setq emacs-wiki-meta-charset "UTF-8")
;;end

;;flyspell
(autoload 'flyspell-mode "flyspell" "On-the-fly spelling checker." t)
(autoload 'flyspell-delay-command "flyspell" "Delay on command." t)
(autoload 'tex-mode-flyspell-verify "flyspell" "" t)
(add-hook 'LaTeX-mode-hook 'flyspell-mode) ;;LaTeX 

;;todo-mode
(autoload 'todo-mode "todo-mode"
                    "Major mode for editing TODO lists." t)
(autoload 'todo-show "todo-mode"
                    "Show TODO items." t)
(autoload 'todo-insert-item "todo-mode"
                    "Add TODO item." t)
(setq todo-file-do "~/emacs/todo-do")
(setq todo-file-done "~/emacs/todo-done")
(setq todo-file-top "~/emacs/todo-top")

;;planner mode
(add-to-list 'load-path "~/elisp/planner")
(add-to-list 'load-path "~/elisp/remember")
(require 'planner)
(require 'remember)
(require 'planner-id)
(require 'planner-deadline)
(require 'planner-notes-index)
(require 'planner-diary)
(setq planner-carry-tasks-forward t)

;;  (global-set-key (kbd " p") 'planner-create-task-from-buffer)
(planner-option-customized 'planner-directory "~/emacs/plans")
  (setq planner-publishing-directory "~/Sites/Wikiwiki/plan" )
;;calendar
(planner-calendar-insinuate)
  ;;(setq planner-calendar-show-planner-files t)
(require 'remember-planner)
(setq remember-handler-functions '(remember-planner-append))
(setq remember-annotation-functions planner-annotation-functions)
;;publish calendar
;;(require 'planner-calendar)
;;(add-hook 'emacs-wiki-mode-hook
;;             (lambda ()
;;               (add-hook 'emacs-wiki-after-file-publish-hook
;;                         'planner-calendar-create-today-link nil t)))
;;end of publis calendar
;;publish iCal
;;(planner-ical-export-file
;; (planner-today)
;; (expand-file-name "tasks.ics"
;;                   planner-publishing-directory))
;;end

;;del.icio.us-planner
;;(add-to-list 'load-path "~/elisp/delicious-el/")
;;(setq delicious-api-user "mcwolf"
;;        delicious-api-password "D974082"
;;        delicious-api-from "wwzhang@gmail.com")
;;(require 'delicious)

;;planner-browser
(load "planner-browser")

;;Notes Mode
(load "notesmode.el")

;;frame
;;(setq one-buffer-one-frame nil)

;;shell with ansi color
(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

;;default dir
(setq default-directory "~/emacs/")

;;tabbar mode
(require 'tabbar)
(tabbar-mode)
(global-set-key [M-S-left] 'tabbar-backward)
(global-set-key [M-S-right] 'tabbar-forward)
(global-set-key [M-S-up] 'tabbar-forward-group)
(global-set-key [M-S-down] 'tabbar-backward-group)
(setq tabbar-buffer-groups-function 'tabbar-buffer-ignore-groups)
(defun tabbar-buffer-ignore-groups (buffer)
;;Return only one group for each buffer."
  (with-current-buffer (get-buffer buffer)
    (cond
     ((or (get-buffer-process (current-buffer))
          (memq major-mode
                '(comint-mode compilation-mode)))
      '("Process")
      )
     ((member (buffer-name)
              '("*scratch*" "*Messages*"))
      '("Common")
      )
     ((eq major-mode 'dired-mode)
      '("Dired")
      )
     ((memq major-mode
            '(help-mode apropos-mode Info-mode Man-mode))
      '("Help")
      )
     ((memq major-mode
            '(rmail-mode
              rmail-edit-mode vm-summary-mode vm-mode mail-mode
              mh-letter-mode mh-show-mode mh-folder-mode
              gnus-summary-mode message-mode gnus-group-mode
              gnus-article-mode score-mode gnus-browse-killed-mode))
      '("Mail")
      )
     (t
      (list
       "default"  ;; no-grouping
       (if (and (stringp mode-name) (string-match "[^ ]" mode-name))
           mode-name
         (symbol-name major-mode)))
      )

     )))
;;end of conf
;;Chinese font
(require 'carbon-font)

;;(require 'color-theme)

;;
(setq calendar-latitude +31.2477)
(setq calendar-longitude +121.4726)
(setq calendar-location-name "Shanghai")

;;Dired
(require 'dired)
(require 'dired-x)
(setq dired-recursive-copies 'top)
(setq dired-recursive-deletes 'top)
(define-key dired-mode-map "o" 'wenzhang-dired-open-mac)
(defun wenzhang-dired-open-mac ()
    (interactive)
    (let ((file-name (dired-get-file-for-visit)))
      (if (file-exists-p file-name)
          (shell-command (concat"open " file-name nil )))))
;;end of Dired

;;
(show-paren-mode t)
(setq show-paren-style 'parentheses)

;;emms Music
(add-to-list 'load-path "~/elisp/emms/")
(require 'emms)
(require 'emms-default)
(emms-setup 'default "~/Music/music")
;;open planner to get reminded
(plan)
;;(planner-update-wiki-project)
;;(calendar)
;;(color-theme-billw)

My XeLaTeX Template

\documentclass[a4paper,dvipdfm]{article}
\usepackage{fontspec}
\setromanfont{STSong}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt
\usepackage[dvipdfm]{graphicx}
\usepackage[usenames,dvipsnames]{color}
\usepackage{xcolor}
\usepackage{threeparttable}
\usepackage[left=2.25cm,right=2.25cm,top=2.5cm,bottom=2.5cm]{geometry}
\DeclareGraphicsExtensions{.eps,.ps,.eps.gz,.ps.gz,.eps.Z,.EPS,.pdf,.PDF}
\usepackage{caption2}
%\usepackage[rightcaption]{sidecap}
\usepackage{colortbl}
\arrayrulecolor{black}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{amsfonts}
\usepackage[section]{placeins}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{Happy \LaTeX{ing}}
\chead{}
\rhead{\bfseries }
\lfoot{Wen Zhang}
\cfoot{\textcolor[rgb]{0.50,0.00,0.50}{\bfseries \thepage}}
\rfoot{Personal Use}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
%\usepackage{CJK}
\usepackage[dvipdfm,a4paper,CJKbookmarks,bookmarks=true,bookmarksopen=true]{hyperref}
\hypersetup{
    pdftitle={},
    pdfauthor={Wen Zhang},
    pdfkeywords={},
    bookmarksnumbered,
    pagebackref=true,
    breaklinks=true,
%    pdfview=FitH,       % Or try pdfstartview={FitV}, This lead to uncorrect bookmarks
    urlcolor=cyan,
    colorlinks=true,
    citecolor=magenta,          %citeref's color
    linkcolor=magenta,
	    }

\title{}
\author{}
\date{} % delete this line to display the current date

\begin{document}
%\begin{CJK*}{GB}{kai,song,hei,fs,li,you}

\newpage
\small
\bibliographystyle{elsart-num}
%\bibliographystyle{wen}
\bibliography{}
%\end{CJK*}
\end{document}
 

XeTeX template

\documentclass{article}
\usepackage{fontspec}
\setromanfont{STSong}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

Link: 用Mac的好处:中文LaTeX用户的惊天喜讯

Joi Ito seeded a TeX Live BitTorrent seed

For all of you who are facinated by LaTeX as I am, this is good news. The down side, he is seeding the CD file, not the DVD one.

Run LaTeX for TeXLive or MikTeX 2.4 CD

Since I don’t want to leave large disk space for CTeX to enjoy LaTeXing in Windows, I just downloaded TeXLive and MikTeX 2.4 for test. But I found using CJK package to processing Chinese can’t produce Chinese at all, so I digged into texmf directories of both and found the gbsn font map. And this is the solution, use \begin{CJK}{GB}{gbsn}

Ease your config of Chinese Fonts using texmf-zh on Linux

软件包:texmf-zh
New: 是
状态: 已安装
Automatically installed: no
版本号:0.1-6
优先级:可选
部分:tex
维护者:Zhan Jian
未压缩尺寸:106k
依赖于: gbkfonts, tetex-bin
建议: cjk-latex
描述:TEXMF for CJK-LaTeX including Chinese fonts installer.
install-gbkfonts: convert TrueType fonts in GBK encoding into Type1
format and generate config files.
update-gbkfonts: update fonts cache and regenerate config files.
remove-gbkfonts: remove installed fonts for texmf-zh.

All Chinese fonts and config files will be installed into /usr/share/texmf-zh

Rant on Comp.text.tex

Peter Flynn on comp.text.tex

\begin{rant}
Spaces in filenames and directory names are evil. They make your teeth
fall out, give you spots, cause global warming, nuclear war, etc.
\end{rant}

///Peter

Have fun on LaTeX

Using Threeparttable package in LaTeX

Using this package in LaTeX the creation of tables in LaTeX will not bother you more about the width of the text.

A minimal example is offered below:

——————
\begin{threeparttable}
\caption{} \label{put_a_lable_here}
\begin{tabular}
Table contents here
you can add tnote{put_a_sign_here} for some thing
\end{tabular}
\begin{tablenotes}
\item[]
\item[put_a_sign_here]
\end{tablenotes}
\end{threeparttable}
——————

So it is easy to do. Isn’t it?

Make TeX/LaTeX files using SciTE

SciTE is a SCIntilla
based Text Editor. It can be run on both Windows and Linux systems. I
find it is very powerful and easy to configure.

I managed to create a personal setting to let it call other programs
to do the compile job for my TeX/LaTeX files and view the outputs.
Below is my personal setting in SciTEUser.properties file on Windows
XP, it is eay to modify it for Linux box.

——————————————-
tabbar.visible=1
tabbar.hide.one=0
line.margin.visible=1
line.margin.width=4+
buffers=10

command.name.1.*.tex=LaTeX
command.1.*.tex=LaTeX $(FilePath)
command.is.filter.1.*.tex=1
command.subsystem.1.*.tex=1

command.name.2.*.tex=BibTeX
command.2.*.tex=BibTeX $(FileDir)\$(FileName)
command.is.filter.2.*.tex=1
command.subsystem.2.*.tex=1

command.name.3.*.tex=View DVI
command.3.*.tex=yap $(FileDir)\$(FileName).dvi
command.is.filter.3.*.tex=1
command.subsystem.3.*.tex=1

command.name.4.*.tex=DVI2PDF
command.4.*.tex=dvipdfm $(FileDir)\$(FileName).dvi
command.is.filter.4.*.tex=1
command.subsystem.4.*.tex=1

command.name.5.*.tex=View PDF
command.5.*.tex=C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe
$(FileDir)\$(FileName).pdf
command.is.filter.5.*.tex=1
command.subsystem.5.*.tex=1
————————————————–

For info and the properties file view href=”http://scintilla.sourceforge.net/SciTEDoc.html”>SciTEDoc.