Difference between revisions of "Writing Guidelines"

From NMSL
Line 132: Line 132:
 
* If we use 'Pattern' to fill an object, the resulting  eps fil will have Type 3 fonts, which cause problems in the PDF file and will not be accepted by many publishers.  Use 'Filled' with 100% instead.
 
* If we use 'Pattern' to fill an object, the resulting  eps fil will have Type 3 fonts, which cause problems in the PDF file and will not be accepted by many publishers.  Use 'Filled' with 100% instead.
 
* Alternatively, a patch for xfig/transfig can be found [http://konstantin.shemyak.com/sw/ here]. With a patched xfig, we can generate Type 3 font free eps files with patterns. It is, however, reported that these eps files do not look good in ghostscript PS readers.
 
* Alternatively, a patch for xfig/transfig can be found [http://konstantin.shemyak.com/sw/ here]. With a patched xfig, we can generate Type 3 font free eps files with patterns. It is, however, reported that these eps files do not look good in ghostscript PS readers.
 +
* The xfig on nsl/nsl-cpu has been patched. However, it might be a good idea to check your final PDF files in acroread using File->Properties. Remember to ensure: (i) no Type 3 fonts appear and (ii) all fonts are embedded.

Revision as of 10:01, 27 October 2009

Embed Fonts in PDF Files

It is required by IEEE, ACM and many other publishers that all fonts are embedded in the document. Embedding fonts is important in order to make the document look and print in the same way the authors intended on different systems.

  • Easiest Way (if you are using TeXnicCenter): Download this Output Profile and import it in your TeXnicCenter system (Build --> Define Output Profiles --> Import ...). Always compile your document with that profile.
  • Or you can use the following argument line for ps2pdf post processor (in the profile editor of TeXnicCenter)
-sDEVICE=pdfwrite -q -dBATCH -dNOPAUSE -dSAFER -dPDFX -dPDFSETTINGS=/prepress
-dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode
-dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -sOutputFile="%bm.pdf"
-c save pop -f "%bm.ps"      
  • You can use the following script with Ghostscript (original source of the script is here.) Of course change the "outFile.pdf" and "inputFile.pdf" to your files.
gs -sDEVICE=pdfwrite -q -dBATCH -dNOPAUSE -dSAFER \
-dPDFX \
-dPDFSETTINGS=/prepress \
-dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode \
-dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode \
-sOutputFile=outFile.pdf \
-c `> setdistillerparams` \
-f inputFile.pdf \
-c quit 

Exporting Matlab Figure in The "Right" Dimension

  • The following scripts set labels and legend into Latex mode, and fix the figure size.

Two figures in a row:

set(gca,'FontSize',18)
set(gca, 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'interpreter', 'latex');
set(get(gca, 'xlabel'), 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'FontSize', 18);
set(get(gca, 'ylabel'), 'interpreter', 'latex');
set(get(gca, 'ylabel'), 'FontName', 'Times New Roman');
set(get(gca, 'ylabel'), 'FontSize', 18);
set(legend(), 'interpreter', 'latex');
set(legend(), 'FontName', 'Times New Roman');
set(legend(), 'FontSize', 18);
set(gcf, 'WindowStyle', 'normal');
set(gca, 'Unit', 'inches');
set(gca, 'Position', [.6 .6 4.6 3.125]);
set(gcf, 'Unit', 'inches');
set(gcf, 'Position', [0.25 2.5 5.5 4.05]);
% it repeats here -- matlab does not resize figure properly with only run of the script
set(gca,'FontSize',18)
set(gca, 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'interpreter', 'latex');
set(get(gca, 'xlabel'), 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'FontSize', 18);
set(get(gca, 'ylabel'), 'interpreter', 'latex');
set(get(gca, 'ylabel'), 'FontName', 'Times New Roman');
set(get(gca, 'ylabel'), 'FontSize', 18);
set(legend(), 'interpreter', 'latex');
set(legend(), 'FontName', 'Times New Roman');
set(legend(), 'FontSize', 18);
set(gcf, 'WindowStyle', 'normal');
set(gca, 'Unit', 'inches');
set(gca, 'Position', [.6 .6 4.6 3.125]);
set(gcf, 'Unit', 'inches');
set(gcf, 'Position', [0.25 2.5 5.5 4.05]);

Three figures in a row:

set(gca,'FontSize',20)
set(gca, 'FontName', 'Times New Roman');
set(gca,'TickDir','out')
set(get(gca, 'xlabel'), 'interpreter', 'latex');
set(get(gca, 'xlabel'), 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'FontSize', 20);
set(get(gca, 'ylabel'), 'interpreter', 'latex');
set(get(gca, 'ylabel'), 'FontName', 'Times New Roman');
set(get(gca, 'ylabel'), 'FontSize', 20);
set(legend(), 'interpreter', 'latex');
set(legend(), 'FontName', 'Times New Roman');
set(legend(), 'FontSize', 20);
set(gcf, 'WindowStyle', 'normal');
set(gca, 'Unit', 'inches');
set(gca, 'Position', [.65 .65 4.6 3.125]);
set(gcf, 'Unit', 'inches');
set(gcf, 'Position', [0.25 2.5 5.5 4.05]);
% it repeats here -- matlab does not resize figure properly with only run of the script
set(gca,'FontSize',20)
set(gca, 'FontName', 'Times New Roman');
set(gca,'TickDir','out')
set(get(gca, 'xlabel'), 'interpreter', 'latex');
set(get(gca, 'xlabel'), 'FontName', 'Times New Roman');
set(get(gca, 'xlabel'), 'FontSize', 20);
set(get(gca, 'ylabel'), 'interpreter', 'latex');
set(get(gca, 'ylabel'), 'FontName', 'Times New Roman');
set(get(gca, 'ylabel'), 'FontSize', 20);
set(legend(), 'interpreter', 'latex');
set(legend(), 'FontName', 'Times New Roman');
set(legend(), 'FontSize', 20);
set(gcf, 'WindowStyle', 'normal');
set(gca, 'Unit', 'inches');
set(gca, 'Position', [.65 .65 4.6 3.125]);
set(gcf, 'Unit', 'inches');
set(gcf, 'Position', [0.25 2.5 5.5 4.05]);

Exporting Microsoft Visio Drawings to EPS

To convert Visio-drawn figures to EPS files preserving their vector format, the following options are suggested. The first one, which is more recommended, is to print the Visio image into a PDF file using a PDF printer such as PDFCreator, and convert the PDF file to EPS. The use of ImageMagick for converting PDF to EPS is recommended. The second option is to save the Visio image as a WMF or EMF (Windows-specific vector image formats), and then convert it to EPS using a software called EMF2EPS. The software requires a PostScript Printer Driver, such as Adobe's. Note that printing the Visio file directly to EPS using this printer does not preserve the vector format of the images. All of the softwares mentioned are free.


Math Symbols in xfig Figures

  • There are a couple of other ways to typeset mathematical formulas in figures generated by xfig. We present one straightforward approach. Please read the original page , where steps 1, 2, 3, 5, 6 are mandatory. Others are optional. We summarize it as follows.
  1. First you're in Xfig. Write equations or characters in the schematic. You need $ in both sides, eg, $\phi$.
  2. Press the "Edit" icon and turn on the Special flag.
  3. Export the figure into Combined Postscript/LaTeX instead of the usual Encapsulated postscript (EPS) .
  4. Add \usepackage{epsfig} to your preamble.
  5. You might need to add \usepackage{color} to your preamable
  6. When storing fig files in a different from tex files, you need to manually modify pstex_t files whenever you export them. E.g.. I have to change \epsfig{file=coverage.pstex}% into \epsfig{file=../fig/coverage.pstex}%.
  7. Write the following command to insert your figure in TeX file:
\begin{figure}[ht]
  \centering{
    \resizebox{.48\textwidth}{!} {
      \input{../fig/coverage.pstex_t}
    }
  }
  \caption{Test.} \label{fig:test}
\end{figure}


Extract Raw Data Points from An Existing Matlab Fig File

  • To extract data points from an existing Matlab fig file:
hl = findobj(gca,'type','line');
xx = get(hl,'xdata');
yy = get(hl,'ydata');

Avoid Type 3 Font in xfig Figures

  • If we use 'Pattern' to fill an object, the resulting eps fil will have Type 3 fonts, which cause problems in the PDF file and will not be accepted by many publishers. Use 'Filled' with 100% instead.
  • Alternatively, a patch for xfig/transfig can be found here. With a patched xfig, we can generate Type 3 font free eps files with patterns. It is, however, reported that these eps files do not look good in ghostscript PS readers.
  • The xfig on nsl/nsl-cpu has been patched. However, it might be a good idea to check your final PDF files in acroread using File->Properties. Remember to ensure: (i) no Type 3 fonts appear and (ii) all fonts are embedded.