Skip to content
Snippets Groups Projects
Select Git revision
  • 9ea5b86a95b45986d93e62cfeef75ffd7042ed08
  • master default protected
  • 9.0
  • 8.0
  • nt-tools
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2020
  • v8.0.2018
  • v8.0.2016
  • v8.0.2014
  • v8.0.2012
  • v8.0.2008
  • v8.0.2006
  • v8.0.2004
  • v8.0.2002
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
41 results

pdflatex.pike

Blame
  • pdflatex.pike 2.43 KiB
    #include "types.h"
    #if __VERSION__ >= 0.6
    import ".";
    #endif /* __VERSION__ >= 0.6 */
    
    // Requires:
    //  ghostscript 5.10 or later
    //  teTeX 1.0.*
    //  transfig 3.2.1
    
    inherit "latex";
    
    string extention=".pdftex";
    string latex="pdflatex";
    
    array(string) quote_to=
    ({"\\symbol{60}","\\symbol{62}",
      "\\symbol{123}","\\symbol{125}",
      "$\\mu$","\\symbol{38}",
      "\\symbol{32}","\\symbol{92}",
      "\\symbol{91}","\\symbol{93}",
      "\\#","\\%",
      "\\$","\\symbol{126}",
      "\\symbol{94}","\\_",
    });
     
    string convert_gfx(TAG tag)
    {
      string file;
      float dpi;
      [file,dpi]=Gfx.convert( tag->params,
    			  "png|jpg|pdf",
    			  300.0,
    			  tag->data && Sgml.get_text(tag->data));
      
      if(!file) return "\\{Large Error, no file}\n";
    
      switch( (file/".")[-1] )
      {
    //    case "tex": return "\\input{"+file+"}";
        case "tpi":
        case "tex":
        case "pdf":
          return "\\includegraphics{"+file+"}";
    
        default:
          return "\\{Huge error, wrong extention}";
    
        case "png":
        case "jpg":
        case "jpeg":
    //      return "\\epsfbox{"+file+"}";
          
          return sprintf("\\pdfimageresolution=%d\n\\includegraphics{%s}",
    		     (int)dpi,
    		     file);
      }
    }
    
    Sgml.Tag illustration(object o,void|mapping options)
    {
      return Sgml.Tag("image",
    		  (["src":Gfx.mkpng(o,options),
    		   "dpi": (string) (options->dpi || "75"),
    		    ])
    		  ,0);
    }
    
    Sgml.Tag illustration_jpeg(object o,void|mapping options)
    {
      return Sgml.Tag("image",
    		  (["src":Gfx.mkjpg(o,options),
    		   "dpi": (string) (options->dpi || "75"),
    		    ]),0);
    }
    
    string package(string x)
    {
      return #"
    \\pdfoutput=1
    \\relax
    \\documentclass[twoside,a4paper]{book}
    \\input{idonex-fonts.tex}
    \\usepackage{isolatin1}
    \\usepackage{latexsym}  % For $\Box$
    \\usepackage{amsmath}
    \\usepackage{longtable}
    \\usepackage[pdftex]{graphicx}
    \\usepackage[pdftex]{color}
    \\usepackage{colortbl}
    \\usepackage{parskip}
    \\usepackage{multicol}
    \\usepackage[pdftex,breaklinks,colorlinks,linkcolor=black]{hyperref}
    \\begin{document}
    \\author{wmml2pdflatex}
    \\setlength{\\unitlength}{1mm}
    
    {\\catcode`\\^^20=\\active\\catcode`\\^^0d=\\active%
    \\global\\def\\startcode{\\catcode`\\^^20=\\active\\def^^20{\\hbox{\\ }}%
    \\catcode`\\^^0d=\\active\\def^^0d{\\hskip0pt\\par\\noindent}%
    \\parskip=1pt\\tt}}
    
    "+
        x+
        "\\LoadCustomFonts\\end{document}\n";
    }
    
    
    void create()
    {
      if(file_stat("fonts"))
      {
        putenv("TEXPSHEADERS","fonts:");
        putenv("TEXINPUTS","fonts:");
        putenv("TTFONTS","fonts:");
        putenv("TFMFONTS","fonts:");
      }
      ::create();
    }