Skip to content

Instantly share code, notes, and snippets.

View ngn999's full-sized avatar
💭
I may be slow to respond.

ngn999 ngn999

💭
I may be slow to respond.
View GitHub Profile
@ngn999
ngn999 / xelatex.tex
Last active December 18, 2015 15:49
xeLaTeX example
% 使用xelatex, 且存成utf-8, 用%!来控制TeXShop选择xeLaTeX
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[12pt]{article}
% 导言区
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{letterpaper} % ... or a4paper or a5paper or ...
%\geometry{landscape} % Activate for for rotated page geometry
%\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
@ngn999
ngn999 / tikz-uml-install.md
Last active December 9, 2016 21:36
how to install tikz-uml

tikz-uml都已经1.0b了, 快要正式发布了吧,哈哈. 但是安装手册还没写 :( . 在这儿补一个MacTeX下的手动安装步骤:

主要是那两个路径哈.

#!/bin/sh

mkdir -p ~/Library/texmf/tex/latex/tikz-uml/
mkdir -p ~/Library/texmf/doc/latex/tikz-uml/
@ngn999
ngn999 / table.md
Last active December 16, 2015 05:49
test markdown table
column a | column b
|:-----|:-----|
a|b
c|d

生成的表格如下:

column a | column b

@ngn999
ngn999 / zhoubao.md
Last active December 15, 2015 07:19
周报模板
定义一个 markdown-mode下的 snippet
<pre>
# -*- mode: snippet -*-
# name: zhoubao
# key: zhoubao
# binding: C-c C-n
# --
## ${1:#你的名字#}周报
`(concat "__" (yesterday-is 1) " ~ " (tommorow-is 5) "__")`
(defun add-py-header ()
"check and add # -*- coding: utf-8 -*-"
(interactive)
(let ((pyheader "# -*- coding: utf-8 -*-"))
(if (not (equal pyheader (buffer-substring-no-properties 1 (1+ (length pyheader)))))
(progn (goto-char 1)
(insert (concat pyheader "\n\n"))))))
@ngn999
ngn999 / boxjoin.md
Created January 13, 2013 17:27
boxjoin 的用法
beginfig(250)
  boxjoin(a.se = b.sw; a.ne = b.nw);
  boxit.a1(btex a etex);
  boxit.a2(btex b etex);
  boxit.a3(btex c etex);
  boxit.a4(btex d etex);
  drawboxed(a1,a2,a3,a4);
endfig;

在两pair的中点,画一个红色的叉

u:=1cm;
pair a,b;
a := (3,4)*u;
b := (0.5,0)*u;

draw a--b;
numeric xmax,ymax,xmin,ymin;
xmax := 4;
ymax := 2;
xmin := 0;
ymin := 0;

numeric ux,uy;
ux := 1cm;
uy := 1cm;
pair a,b,c;
numeric u;
u:=2cm;
a:=(0,0)*u;
b:=(1,0)*u;
c:=(0.5,0.8)*u;

draw a{up} .. c;
draw a{right} .. c;

numeric u; % 声明和定义不能同时

u := 2cm;
pair o,a,b;

o := (0,0)*u;
a := (1,0)*u;

draw o -- (1,0)*u;