Skip to content

Useful Tricks in Microsoft Word

November 17, 2018

Return to the location you edited last time

This is especially useful if you are editing a long document.

  • Method 1: Shift+F5, this is the simplest way
  • Method 2: On the right hand side of MS word 2018, there will be a flag for this purpose.
Advertisements

Latex color text

October 26, 2018

If you would like to change the color of some text in latex, there are two ways:

  • \textcolor{<color>}{...}

Example:

\definecolor{myColor}{RGB}{0,0,200}
\newcommand{\blue}{\textcolor{blue}}

\blue{xxxx}

This way it is very simple to change the color of some text. However, its problem is that it does not allow line breaks. It would be very annoying to use this command if you would like to change the color of many paragraphs.

  • {\color{<color>}...}

Example:

\usepackage{xcolor}

{\color{blue}

Paragraph 1 xxx
paragraph 2 xxx
}

This way is powerful because you can change the color an entire section if needed. Note that here you do not need to define the color blue, it is a default color.

Latex: multiple columns with different/uneven width

March 18, 2018

Different methods that do not work:

First,

\usepackage{multicol}
\begin{multicols}{2}
\end{multicols}

The problem of this method is that you cannot adjust the column width, which is automatically calculated by the package.

Second,

\usepackage{vwcol}
\begin{vwcol}[widths={0.6,0.4}]
\end{vwcol}

The problem is that it simply does not work properly and I didn’t spend too much time digging out. The supporting websites are not many.

Third,

using tables. The problem is that when I insert sections or other environments in tables, there were errors. I guess table is after all a local environment. It is not suitable to put all the document in tables.

Method that works:

minipage:

\noindent
\begin{minipage}[c]{0.6\linewidth}
xxx
\end{minipage} % no space if you would like to put them side by side
\begin{minipage}[c]{0.3\linewidth}
xxx
\end{minipage}

 

 

 

Latex支持中文和修改中文字体

January 30, 2018

如何设置CTex使之支持中文:

很好的文章:

http://gaolei786.github.io/latex/helloctex.html

https://wenku.baidu.com/view/dbd74b5b1611cc7931b765ce05087632311274b2.html

上面两个链接是一个文章。

要点是:

  1. 保存类型:类型选”UTF-8”,后缀选择***.tex。也许在下面的{ctex}前面加上[UTF8]也可以。
  2. \usepackage[UTF8]{ctex} %加载包,因为我们在用中文写文档
  3. 就可以直接在WinEdit中对它编译首先要选择合适的编译器:XeLatex, 个编译器对中文支持比较好

我已经成功实现中文输入。不过每次需要点击XeLatex编译,而且不会自动弹出来PDF,需要手动点击PDF预览按钮。

修改F9快捷键:F9默认的是pdflatex来编译,如果我们希望使用xelatex来编译可以修改F9快捷键。注意:一般性的修改快捷键的方式比较复杂,我们直线想修改编辑器,可以通过下面方式修改。Option (menu)->Exaction Modes->Tex Options (tab)->Default PDFTexify Engine:

  • 默认值是pdflatex.exe
  • 改成xelatex.exe即可

我的WinEdt的版本是7,还需要每次指定F9触发的编译器. 更高级的版本可以支持更方便的修改,即只是触发下拉列表里面选择的编译器。https://tex.stackexchange.com/questions/169493/change-default-compiler-by-drop-down-button-in-winedt

把图的Figure变成汉字“图”:\renewcommand{\figurename}{图}

解决“error reading”无法打开的问题:如果是中文的,并且是UTF-8格式的tex,直接双击文件无法打开,会报错。这时候先打开winedt软件,然后open菜单,在选择文件的窗口右下角选择“UTF-8”格式,而非默认的*.*格式。

修改WinEdt显示的字体:修改font文件里面的

FONT_NAME=”Calibri” //”Calibri” //”Times New Roman”// “SimSun” //default “Courier New”

如何修改中文字体:

下面是我测试完的管用的:

http://blog.csdn.net/programchangesworld/article/details/51429138

要点:

1. 改变字体分为两种,一种是全局改变,一种是局部改变。

\usepackage{CJK}
% 用于全局修改字体
\setCJKmainfont{STXingkai}
% 用于局部修改字体
\setCJKfamilyfont{hwxk}{STXingkai}
\newcommand{\huawenxingkai}{\CJKfamily{hwxk}}

局部修改的方法:{\huawenxingkai 测试字体}

2. 哪些字体可选择:上面是STXingkai是行楷,还有

STCaiyun,华文彩云:style=Regular
YouYuan,幼圆:style=Regular
STHupo,华文琥珀:style=Regular
KaiTi_GB2312,楷体_GB2312:style=Regular
NSimSun,新宋体:style=Regular
FangSong_GB2312,仿宋_GB2312:style=Regular
SimSun,宋体:style=Regular
STXinwei,华文新魏:style=Regular
SimHei,黑体:style=Regular
STXingkai,华文行楷:style=Regular
LiSu,隶书:style=Regular

我上面测试成功的包括:FangSong, SimSun, NSimSun, STXinwei, SimHei

关于字体代码,参见http://kuing.is-programmer.com/posts/32555.html

Read more…

Latex: usage of subfloat minipage

November 11, 2017
\begin{figure*}
 \centering
\subfloat[]{
\begin{minipage}[b][][t]{.3\textwidth} % [b] bottom [t] top
\centering
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_noIntegralStationary_traj}
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_noIntegralStationary_bearingerror}
\end{minipage}}%
\subfloat[]{
\begin{minipage}[b][][t]{.3\textwidth} % [b] bottom [t] top
\centering
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_noIntegralMoving_traj}
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_noIntegralMoving_bearingerror}
\end{minipage}}%
\subfloat[]{
\begin{minipage}[b][][t]{.3\textwidth} % [b] bottom [t] top
\centering
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_PIMoving_traj}
\includegraphics[width=\linewidth]{fig_sim_singleIntegrator_PIMoving_bearingerror}
\end{minipage}}%
 \caption{The bearing error is $\sum_{(i,j)\in\E}\|g_{ij}-g_{ij}^*\|$.}
 \label{fig_sim_PI_noIntegral}
\end{figure*}

Feedback linearization of Unicycle Model

November 5, 2017

Keywords: unicycle, single integrator, double integrator, feedback linearization

There are two types of feedback linearization of unicycle models. The first is to obtain a single-integrator model. The second is to obtain a double-integrator model (reference for the double integrator model: Automatica “Distributed formation control of nonholonomic mobile robots without global position measurements”).

my memo: unicycle linearization

Get Euler angles from a rotation matrix

July 26, 2017
Matlab function:

function rho=fcn_EulerFromRotation(R)
% R is the rotation from body to world frame

% assume -pi/2<tht<pi/2

%R31=-sin(tht)
tht=-asin(R(3,1));

%R32=sin(phi)*cos(tht), R33=cos(phi)*cos(tht)
phi=atan2(R(3,2),R(3,3));

%R21=cos(tht)*sin(psi), R11=cos(tht)*cos(psi)
psi=atan2(R(2,1),R(1,1));

rho=[phi,tht,psi]';