2013年5月6日 星期一

Switching between leqno and reqno

Using amsmath package, the equation numbering is by default set to right, i.e., reqno. It is possible to change to leqno by \documentclass[leqno,...]{article}, for example. However, if one desires to temporarily switch between the two a good solution can be found at

http://www.golatex.de/wechsel-zwischen-leqno-und-reqno-fleqn-uvm-t2488.html

For convenience, I paste Herbert's code here:

\makeatletter 
\def\Links{\tagsleft@true}\def\Rechts{\tagsleft@false} 
\makeatother 

Examples of use:

\begin{align}
y=f(x) 

\end{align} 

\Links 
\begin{align}
y=f(x) 

\end{align} 

\Rechts 
\begin{align}
y=f(x) 

\end{align} 

2013年3月22日 星期五

Printing "usable" postscript figure in windows 8

This note is to illustrate how to capture an image from a PDF and export as a postscript file in windows 8. The file has to be compatible with latex.

Previously in windows 7, this can be done by printing the selected image in Acrobat with the virtual printer "WMF2EPS Color PS L2". In Win8, there is also a virtual printer called "Microsoft PS Class Driver" that can print files or images as ps files. When viewing the output ps figures with ghostscript, they look pretty fine. The only problem is, there is no bounding box. Without bounding box, we cannot use them directly in doing latex.

The solution I found is that Matlab can help. There is an exchange file on the "File Exchange - MATLAB Central" called "export_fig" by Oliver Woodford. The file can be freely downloaded here. This mini-program outputs figure files in good qualities and may sometimes be needed, in addition to Matlab's built-in command "print". This export_fig can also do pdf2eps, but before having this function work, one has to download necessary files related with xpdf.

Anyway, when this function (pdf2eps) is activated, the following is then the simple procedure of how a captured image in a PDF file can be transformed to an EPS file that is compatible with LaTeX:

1. open the pdf file and select the desired image

2. right-click to print the selected image

3. choose the adobe acrobat virtual printer to output the image in the pdf format (ex.: image.pdf)

4. open matlab and use the pdf2eps command to transform the pdf file into an eps file; then it's done

An example is shown below to summarize the procedure:

Note:
1. In the last view, the dashed box of the eps file shown in ghostview is the bounding box, which is very important when doing latex.
2. Sometimes the boundary of the captured image in the pdf format is not satisfactory. This can be improved by cropping the file in the Adobe Acrobat.