突然发现的很不错的工具,自己写了个CodeRunner的模版,写了几个简单的命令:
setColor{颜色名}{文字}
setImage {宽度}{高度}{图片}
setImageWidth {宽度}{图片}
setImageHeight{高度}{图片}
当然了,这些命名都是从Objective-C那儿来的,这样用起来自己感觉也很熟悉。xelatex真是好伙伴~~
CodeRunner template
%!TEX TS-program = xelatex % 使用xelatex进行处理
%!TEX encoding = UTF-8 Unicode % 使用UTF-8, Unicode
documentclass[12pt,b5paper]{article}
usepackage{float}
usepackage{titlesec}
usepackage{fontspec,xunicode,xltxtra}
usepackage[dvipsnames,usenames]{color}
usepackage[top=1in,bottom=1in,left=1.25in,right=1.25in]{geometry}
defaultfontfeatures{Mapping=tex-text}
newfontfamilyfww{WawaSC-Regular.otf} % 设置娃娃体的别名为fww(font Wa Wa)
newfontfamilyfht{STHeiti} % 设置黑体的别名为fht(font Hei Ti)
setmainfont{STHeiti}
titleformat{section}{Largefht}{thesection}{1em}{}
XeTeXlinebreaklocale"zh"
XeTeXlinebreakskip = 0pt plus 2pt minus 0.1pt
begin{document}
newcommand{setColor}[1]{textcolor{#1}} % 设置文字颜色
newcommand{setImageWidth}[2]{includegraphics[width=#1]{#2}} % 添加图片, 以高度约束
newcommand{setImageHeight}[2]{includegraphics[height=#1]{#2}} % 添加图片, 以宽度约束
newcommand{setImage}[3]{includegraphics[width=#1,height=#2]{#3}} % 添加图片, 同时设定宽与高
title{Untitled}
author{author}
maketitle
%@
end{document}