oBook‎ > ‎

WinFig

Winfig in latex



To make some Latex friendly figures there is a good Windows-based software that works like XFig in Linux. 
Download it from: WinFig.com
WinFig is free for 14 objects in your drawing and you need to pay about US$35 to get the registered one. 

WinFig is vector-based drawing software and the resulted drawing can be exported in different formats. In many technical articles we need to have mathematics symbols and equations on the figures. In WinFig you are able to do that and update the resulted figure online. 
Keep in mind that we are going to use LaTex and Dvi to PDF tools of MikTex.org; so if there are other figures in PDF format in your document you are not be able to use a PS file for your project at the same time. I suggest you change your figures to eps for instance, and use all in the same manner or have a simple PS to PDF latex interface and work on the resulted PDF. The second way has a disadvantage: you are not able to see the changes on the figure right away. You need to convert it first by your interface then the main document is ready for PDFLatex. Anyway the technique here is going to work for every scenario: the direct one and the other with PS to PDF converter.

1. Create a WinFig figure and put your formula with $...$ as you wish. You may pick your choice of the font size; it is important that you set the Special on the right hand column as you see in the below snapshot:
WinFig Text Interface

2. Save your figure and export it from File menu as shown below:


3. Create a latex document with the following packages and text:

\documentclass{article}
\usepackage{epsfig}
\usepackage{color} 
\setlength{\textwidth}{100cm}
\setlength{\textheight}{100cm}
\begin{document}
\pagestyle{empty}
\input{TestLatex.pstex_t}
\end{document}

4. Run LaTex first and DVI -> PDF afterwards. Now you have the PDF format of the figure in correct form. e,g,: 



5. For updating the figure just change it in WinFig, export it again and re-compile the Latex document. 

Enjoy it !

* http://www.ghostscript.com/download/gsdnld.html for seting ghostscript

Fig2PDF

posted Aug 28, 2014, 9:58 PM by Javad Taghia   [ updated Aug 28, 2014, 10:25 PM ]

Unfortunately there is no direct way to export a fig as a pdf with correct special char. management. So we need to actually do the next steps via running latex to have the symbols sort out.
I assume we are going to export our fig file as pstex (export both files). Then we can create a batch file in Windows as:

@echo off
set /p input= "Enter Fig File Name: " 
echo %input%
ECHO  \documentclass[]{article} > out.tex
ECHO \usepackage[a4paper,portrait,scale=1.0,margin=0pt]{geometry} >> out.tex
ECHO  \usepackage[dvips]{graphicx,color} >> out.tex
ECHO  \usepackage{mathrsfs} >> out.tex 
ECHO  \usepackage{amsmath,amssymb}>> out.tex 
ECHO  \thispagestyle{empty}>> out.tex 
ECHO  \begin{document}>> out.tex
ECHO  \input{%input%.pstex_t}    >> out.tex
ECHO   \end{document}>>out.tex
latex out.tex
dvips out.dvi
ps2pdf out.ps
del out.log 
del out.dvi
del out.ps
del out.tex
del out.aux

to ask the user for entering the figure name and then we have a pdf resulted from the figure. 

File and example is attached.

How to Scale

posted May 16, 2014, 1:45 PM by Javad Taghia   [ updated May 16, 2014, 1:45 PM ]

	\begin{figure}[h]
	\begin{center}
	\scalebox{0.5}{\input{fig1.pstex_t}}
	\caption{This is figure 1}
	\label{fig:fig1}
	\end{center}
	\end{figure}

A better example

posted May 15, 2014, 3:32 PM by Javad Taghia   [ updated May 15, 2014, 3:35 PM ]

Here is a better example for a document; we are going to use a figure created by WinFIG in the document. There are some important points:
1. We need to do scaling in the WinFig itself. There is no graphics when we use xxx.pstex_t as our input file. 
2. We need to set the path at Export window of our WinFig file to the folder we put and use or figures. The default value is going to be in the original path.
This can be seen by checking xxx.pstex_t in a editor. The path for xxx.ps file is shown there. It must be correct as the path we use in our LaTex document.
3. Fit to the size is a good option in the Export window but make sure the size is properly set by Magnification option.

Here is a simple example, we use the same figure and repeat it in a table. We assume the figures are in a folder named figs.

 \documentclass[10,a4paper]{article}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{kpfonts}
\usepackage{epsfig}
\usepackage{color} 
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\author{xxx xxx}
\title{xxx xxx}

\begin{document}
\maketitle



\begin{figure}[h]\centering
\begin{tabular}{cc}
\input{figs/StartPage.pstex_t}\\
\input{figs/StartPage.pstex_t}\\
\end{tabular}
\caption{xxx} \label{fig:tractor_trailer}
\end{figure}

\end{document}

1-3 of 3