Advertisement
Marcel-

figflow example

Dec 23rd, 2014
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 4.01 KB | None | 0 0
  1. \newbox\gridbox
  2. \setbox\gridbox\line{%
  3.   \special{color push rgb .8 .8 1}%
  4.   \vrule height\baselineskip width0pt \hrulefill
  5.   \special{color pop}}
  6. \def\grid{\vtop to0pt{\hrule height0pt\kern-\dimexpr\baselineskip-\topskip\topskip=10pt\relax
  7.    \vbox to\dimexpr\vsize+2pt\relax{\leaders\copy\gridbox\vfil}\vss}}
  8. \def\pagebody{\vbox to\vsize{\boxmaxdepth=\maxdepth \grid\pagecontents}}
  9.  
  10. \input figflow
  11. \parskip=0pt \frenchspacing \raggedbottom
  12. \font\smallrm=cmr8
  13.  
  14. \newdimen\thewidth
  15. \newdimen\theheight
  16. \newbox\figbox
  17. \newbox\captbox
  18. \newbox\compbox
  19. %
  20. \def\includegraphics#1#2#3#4{
  21. {\parfillskip=0pt\par}
  22. \thewidth=#1
  23. \theheight=#2
  24. \advance\thewidth by 1pc
  25. \setbox\figbox=\vbox to #2{\hsize=#1
  26. \XeTeXpicfile #3 width #1 height #2}
  27. \setbox\captbox=\vbox{\hsize=#1
  28. {\noindent\smallrm #4\par}}
  29. \advance\theheight by \ht\captbox
  30. \divide\theheight by \baselineskip
  31. \multiply\theheight by \baselineskip
  32. \advance\theheight by \baselineskip
  33. \setbox\compbox=\vbox to \theheight{\vfil\figbox\vskip2mm\captbox}
  34. \figflow{\thewidth}{\theheight}{}%
  35. \vtop to 0pt{\kern0pt\compbox\vss}\nobreak\vskip-\baselineskip
  36. \noindent\ignorespaces}
  37.  
  38. \noindent
  39. A work in progress, {\tt JSBox} is a self-contained
  40. library---written in portable C---that instantiates sandbox-able,
  41. \TeX-language interpreters within the memory space
  42. of any C, Objective-C, or C++ 32- or 64-bit client
  43. program. Built and documented anew, {\tt JSBox}
  44. is faithful to the \TeX\ language's primitives,
  45. syntax, typesetting algorithms, measurements, data
  46. structures, and speed. At the same time, it fixes---in an
  47. upwardly compatible manner---a variety of important
  48. problems with or lacun\ae\ in the current \TeX\ engine's
  49. implementation. These include integral support for
  50. 21-bit Unicode, namespaces, OpenType font tables
  51. and metrics, job-specific 8-bit to 21-bit Unicode
  52. mapping, run-time settable compatibility levels,
  53. full 32-bit fixed-point math, and more.%
  54. \includegraphics{7cm}{7cm}{greybox.png}{Lorem ipsum dolor sit
  55. amet, consectetur adipiscing elit. Donec a diam lectus.}
  56. Especially pertinent to interactive applications---such as an
  57. eBook reader---is that all of a document's pages can
  58. optionally be kept as \TeX\ data structures in memory
  59. after a job is done, with direct random access of any
  60. requested page exported to the client program's screen
  61. without file I/O or DVI or PDF conversion if unneeded.
  62. Tracing (including recursive expansion, re-tracing
  63. interrupted commands, alignments, math, etc.) and
  64. all error messages have been significantly improved
  65. over what \TeX\ does. The author will demo what
  66. {\tt JSBox} can do now, and discuss what it
  67. could do in the future.
  68.  
  69. A work in progress, {\tt JSBox} is a self-contained
  70. library---written in portable C---that instantiates sandbox-able,
  71. \TeX-language interpreters within the memory space
  72. of any C, Objective-C, or C++ 32- or 64-bit client
  73. program. Built and documented anew, {\tt JSBox}
  74. is faithful to the \TeX\ language's primitives,
  75. syntax, typesetting algorithms, measurements, data
  76. structures, and speed. At the same time, it fixes---in an
  77. upwardly compatible manner---a variety of important
  78. problems with or lacun\ae\ in the current \TeX\ engine's
  79. implementation. These include integral support for
  80. 21-bit Unicode, namespaces, OpenType font tables
  81. and metrics, job-specific 8-bit to 21-bit Unicode
  82. mapping, run-time settable compatibility levels,
  83. full 32-bit fixed-point math, and more. Especially
  84. pertinent to interactive applications---such as an
  85. eBook reader---is that all of a document's pages can
  86. optionally be kept as \TeX\ data structures in memory
  87. after a job is done, with direct random access of any
  88. requested page exported to the client program's screen
  89. without file I/O or DVI or PDF conversion if unneeded.
  90. Tracing (including recursive expansion, re-tracing
  91. interrupted commands, alignments, math, etc.) and
  92. all error messages have been significantly improved
  93. over what \TeX\ does. The author will demo what
  94. {\tt JSBox} can do now, and discuss what it
  95. could do in the future.
  96. \bye
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement