Memo-migrated‎ > ‎

My old memo

posted Jul 14, 2010, 1:43 PM by Teng-Yok Lee   [ updated Jan 2, 2021, 7:13 PM ]
  1. Install grep.
  2. Add the following rule at the beginning of the LaTeX files after the library graphix is included:
    • \DeclareGraphicsExtensions{.eps,.eps.gz}
    • \DeclareGraphicsRule{.eps.gz}{eps}{.bb}{}
  3. Convert the image, for instance, img.png to .eps
    • convert img.png img.eps
  4. Extract the BoundingBox
    • grep "%%BoundingBox" img.eps >
  5. Compress the .eps file
    • gzip -9 img.eps
I will suggest to put all color images in a folder and then  use a for loop to execute the following steps.
FOR %p IN (*.png) DO convert %p %~np.eps
FOR %p IN (*.eps) DO grep "%%BoundingBox" %p >
FOR %p IN (*.eps) DO gzip -9 -f %p
  • (01/27/2009) Getting to Grips with Latex - Floats, Figures and Captions by Andrew Roberts
  • (12/19/2008) Create figures in .eps with embedded fonts: use ps2eps/ps2epsi or eps2eps/eps2epsi to convert the figures. Besides, add option "-Pdownload35" to the utility 'dvips.' 
            • For figures from MATLAB: 1) Save as .pdf; 2) Convert to .ps via pdf2ps; 3) Convert to .eps via ps2eps/ps2epsi
            • For figures from Dia: 1) Save as .eps; 2) Convert to .eps w/ fonts via eps2eps/eps2epsi
  • (12/8/2008) Latex - Multiline equations, systems and matrices (link)
  • (10/28/2008) Disable vertical sync. in OpenGL application w/ WGL (this is very important when measuring the speed of OpenGL programs): add the following codes
            • assert(WGL_EXT_swap_control);

  • (08/14/2008) Compile a shader program statically (such that the source shader program can be compiled during the compilation time other than run time):
  1. Check out the latest mylib/libshader and build it. In addition to the library libshader, there is also an application shader2string. The application should be created in mylib/bin.
  2. (VC2005) For a shader program, setup the Custom Build Step as below: 
    • Command Line: ..\bin\shader2string $(InputFileName) $(InputFileName).h
    • Outputs: $(InputFileName).h
  3.  Compile the shader program in the C++ source code as below:
      • uPid = CSetShadersByString(
               #include "shader.vert.h"
               #include "shader.frag.h"
  • (07/29/2008) The options that make ps2pdf losslessly compress images on WinEDT: 
-dBATCH -dNOPAUSE -sDEVICE=pdfwrite -r600 -dCompatibilityLevel=1.3 -sPAPERSIZE=letter -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true -dAutoFilterColorImages=false -dAutoFilterGrayImages=false -dColorImageFilter=/FlateEncode -dGrayImageFilter=/FlateEncode -dMonoImageFilter=/FlateEncode