Guest User

Untitled

a guest
Dec 14th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. setuppapersize[A4][A4]
  2. setuplayout[topspace=0.5in, backspace=1in, header=24pt, footer=36pt,
  3. height=middle, width=middle]
  4.  
  5. defMPclipFive#1#2#3#4%
  6. {startreusableMPgraphic{clip:five:#1#2#3#4}{}
  7. %
  8. delta := #4;
  9. width := #1-delta;
  10. height := #2-delta;
  11. lines := #3;
  12. %
  13. z1 = (0,0);
  14. z2 = (lines,0);
  15. z3 = (.5width,height);
  16. z4 = (width-lines,0);
  17. z5 = (width,0);
  18. %
  19. pickup pencircle
  20. xscaled delta
  21. yscaled .5delta
  22. rotated 30;
  23. %
  24. draw z1--z2{dir 135}...z3...{dir -135}z4--z5 withcolor (.5,.5,.5);
  25. %
  26. pickup pencircle
  27. scaled delta;
  28. %
  29. draw z1 withcolor red;
  30. draw z2 withcolor red;
  31. draw z3 withcolor red;
  32. draw z4 withcolor red;
  33. draw z5 withcolor red;
  34. %
  35. stopreusableMPgraphic
  36. reuseMPgraphic{clip:five:#1#2#3#4}{}}
  37.  
  38. defineoverlay
  39. [NummerAchtergrond]
  40. [MPclipFive{overlaywidth}{overlayheight}{30pt}{5pt}]
  41.  
  42. setuppagenumbering
  43. [c!location={v!footer,v!middle},
  44. c!command=NummerCommando]
  45.  
  46. unexpandeddefNummerCommando#1%
  47. {framed
  48. [c!background=NummerAchtergrond,
  49. c!frame=v!off,
  50. c!offset=6pt]
  51. {lower.5dpstrutboxhbox spread 60pt{hss#1hss}}}
  52.  
  53. %setuppagenumbering[location={footer,center}]
  54.  
  55. setupbodyfont[11pt,palatino]
  56.  
  57. setupindenting[medium,yes]
  58.  
  59. starttext
  60. phantom{Text.}
  61. vfill
  62. midaligned{Text.}
  63. stoptext
  64.  
  65. documentclass[10pt]{article}
  66.  
  67. usepackage[T1]{fontenc}
  68. usepackage[utf8]{inputenc}
  69. usepackage[shellescape,tex]{gmp}
  70. usepackage{xcolor}
  71.  
  72. usepackage{titlesec}
  73.  
  74. defMPclipOne#1#2#3#4#5{begin{mpost}
  75. w := #1; width := 100; wfactor := w/width;
  76. h := #2; height := 100; hfactor := h/height;
  77. color lightred; lightred := (.90,.50,.50);
  78. color lightgray; lightgray := (.95,.95,.95);
  79. color gray; gray := (.50,.50,.50);
  80. def random_delta (expr d) =
  81. d-(uniformdeviate 2d)
  82. enddef;
  83. z1 = (0,height);
  84. z2 = (0,0);
  85. z3 = (width,0);
  86. z4 = (width,height);
  87. z5 = (width+random_delta(.2width),height+random_delta(.2height));
  88. z6 = (.5width+random_delta(.1width),height+random_delta(.1height));
  89. pickup pencircle
  90. xscaled (#3/wfactor)
  91. yscaled (#3/(2*hfactor))
  92. rotated 30;
  93. draw z5..z1..z2..z3..z4..z6 withcolor #4;
  94. pickup pencircle
  95. xscaled (#3/wfactor)
  96. yscaled (#3/hfactor);
  97. draw z1 withcolor #5;
  98. draw z2 withcolor #5;
  99. draw z3 withcolor #5;
  100. draw z4 withcolor #5;
  101. draw z5 withcolor #5;
  102. draw z6 withcolor #5;
  103. newwidth := (xpart (urcorner currentpicture)) -
  104. (xpart (llcorner currentpicture));
  105. newheight := (ypart (urcorner currentpicture)) -
  106. (ypart (llcorner currentpicture));
  107. currentpicture := currentpicture
  108. xscaled (w/newwidth) yscaled (h/newheight);
  109. end{mpost}}
  110.  
  111. defMPclipFive#1#2#3#4%
  112. {begin{mpost}
  113. %
  114. delta := #4;
  115. width := #1-delta;
  116. height := #2-delta;
  117. lines := #3;
  118. %
  119. z1 = (0,0);
  120. z2 = (lines,0);
  121. z3 = (.5width,height);
  122. z4 = (width-lines,0);
  123. z5 = (width,0);
  124. %
  125. pickup pencircle
  126. xscaled delta
  127. yscaled .5delta
  128. rotated 30;
  129. %
  130. draw z1--z2{dir 135}...z3...{dir -135}z4--z5 withcolor (.5,.5,.5);
  131. %
  132. pickup pencircle
  133. scaled delta;
  134. %
  135. draw z1 withcolor red;
  136. draw z2 withcolor red;
  137. draw z3 withcolor red;
  138. draw z4 withcolor red;
  139. draw z5 withcolor red;
  140. %
  141. end{mpost}}
  142.  
  143. % I want to combine this with fancyhdr, perhaps, to get the desired result.
  144.  
  145. newsavebox{tacopage}
  146. newcommand{tacopagenumber}[1]{%
  147. sboxtacopage{#1}%
  148. {ooalign{%
  149. MPclipFive{mpdim{wdtacopage}} % width
  150. {mpdim{httacopage}} % height
  151. {12}
  152. % thickness of the curve
  153. {(.7,.7,.7)}
  154. % color of the curve
  155. {red}
  156. % color of the spots
  157. crhfill
  158. %raisebox{dimexpr.15httacopage+1.5pcrelax}
  159. {boxtacopage}hfill
  160. }}}
  161.  
  162. % For the section formatting
  163.  
  164. newsavebox{tacochapterbox}
  165. newcommand{tacochapterhead}[1]{%
  166. sboxtacochapterbox{Largebfseries #1}%
  167. {ooalign{%
  168. MPclipOne{mpdim{wdtacochapterbox+6pc}} % width
  169. {mpdim{httacochapterbox+3pc}} % height
  170. {8}
  171. % thickness of the curve
  172. {(.7,.7,.7)}
  173. % color of the curve
  174. {red}
  175. % color of the spots
  176. crhfillraisebox{dimexpr.5httacochapterbox+1.5pcrelax}
  177. {boxtacochapterbox}hfill}}}
  178.  
  179. newcommand{secformat}[1]{tacochapterhead{thesection raisebox{-4pt}{textcolor{green}{rule{1pt}{baselineskip}}} #1}}
  180. titleformat{name=section}[block]
  181. {largebfseriesfilcenter}{}{0pt}{secformat}
  182. titleformat{name=section,numberless}[block]
  183. {largebfseriesfilcenter}{}{0pt}{tacochapterhead}
  184.  
  185. begin{document}
  186.  
  187.  
  188. %maketitle
  189. section{A section}
  190.  
  191. tacopagenumber{a try}
  192.  
  193. end{document}
Add Comment
Please, Sign In to add comment