Guest User

Untitled

a guest
Oct 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. documentclass{scrbook}
  2.  
  3. usepackage{tikz}
  4.  
  5. usepackage{listings}
  6. lstset{%
  7. language=[LaTeX]TeX,
  8. commentstyle=color{gray},
  9. breaklines=true,
  10. frame=single,
  11. frameround=tttt,%
  12. framextopmargin=10pt,
  13. framexbottommargin=7pt,
  14. xleftmargin=22pt,
  15. framexleftmargin=10pt,
  16. framesep=10pt
  17. }
  18.  
  19. % - - - - - - - - - - - - - % Code for highlighting.
  20.  
  21. makeatletter%
  22. newenvironment{btHighlight}[1][]%
  23. {begingrouptikzset{bt@Highlight@par/.style={#1}}begin{lrbox}{@tempboxa}}%
  24. {end{lrbox}bt@HL@box[bt@Highlight@par]{@tempboxa}endgroup}
  25.  
  26. newcommandbtHL[1][]{%
  27. begin{btHighlight}[#1]bgroupaftergroupbt@HL@endenv%
  28. }
  29. defbt@HL@endenv{%
  30. end{btHighlight}%
  31. egroup%
  32. }
  33. newcommand{bt@HL@box}[2][]{%
  34. tikz[#1]{%
  35. pgfpathrectangle{pgfpoint{1pt}{0pt}}{pgfpoint{wd #2}{ht #2}}%
  36. pgfusepath{use as bounding box}%
  37. node[anchor=base west, fill={oposmy!30},outer sep=0pt,inner xsep=1pt, inner ysep=0pt, minimum height=htstrutbox+1pt,#1]{raisebox{1pt}{strut}strutusebox{#2}};%
  38. }%
  39. }%
  40. makeatother%
  41.  
  42. lstdefinestyle{SQL}{%
  43. moredelim=**[is][btHL]{`}{`},%
  44. moredelim=**[is][{btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}%
  45. }
  46.  
  47. % - - - - - - - - - - - - - %
  48.  
  49. usepackage{xcolor}
  50. definecolor{oposmy}{HTML}{c0f1ff}
  51.  
  52. begin{document}
  53.  
  54. begin{lstlisting}[style=SQL]
  55. documentclass{scrbook}
  56.  
  57. `usepackage{fontspec`}% #1
  58. setmainfont{`Latin Modern Sans Demi Cond`}% #2
  59.  
  60. usepackage{tikz}
  61. usetikzlibrary{shapes.misc}
  62.  
  63. begin{document}
  64.  
  65. begin{tikzpicture}
  66. `node[draw,rounded rectangle, rounded rectangle arc length=180] {Text};`% #3
  67. end{tikzpicture}
  68.  
  69. Press the `F1` key for help. Press the `tikz[baseline] draw node[anchor=base,draw,double,rounded corners] {{texttt{F11}}};` key for full screen.% #4
  70.  
  71. end{document}
  72. end{lstlisting}
  73.  
  74. end{document}
  75.  
  76. documentclass{scrbook}
  77.  
  78. usepackage{atbegshi,ifthen,listings,tikz}
  79. usepackage{xcolor}
  80.  
  81. definecolor{oposmy}{HTML}{C0F1FF}
  82. tikzstyle{highlighter} = [ oposmy, line width = baselineskip ]
  83.  
  84. makeatletter
  85.  
  86. newcounter{highlight}[page]
  87. newififhl@active
  88.  
  89. newcommand{tikzhighlightanchor}[1]{%
  90. ensuremath{vcenter{hbox{%
  91. tikz[remember picture, overlay]{coordinate (#1 highlight arabic{highlight});}}}}%
  92. }
  93. newcommand{bh}[0]{%
  94. stepcounter{highlight}%
  95. tikzhighlightanchor{begin}%
  96. }
  97. newcommand{eh}[0]{%
  98. tikzhighlightanchor{end}%
  99. }
  100. newcommand{hlstyle}{%
  101. globalhl@activetrue
  102. bh
  103. aftergrouphlstyleend
  104. }
  105. newcommand{hlstyleend}{%
  106. eh
  107. globalhl@activefalse
  108. }
  109.  
  110. AtBeginShipout{AtBeginShipoutUpperLeft{%
  111. ifthenelse{value{highlight} > 0}{%
  112. tikz[remember picture, overlay]{foreach stroke in {1,...,arabic{highlight}}
  113. draw[highlighter] (begin highlight stroke) -- (end highlight stroke);}}{}%
  114. }}
  115.  
  116. usepackage{listings}
  117. lstset{%
  118. language=[LaTeX]TeX,
  119. commentstyle=color{gray},
  120. breaklines=true,
  121. frame=single,
  122. frameround=tttt,%
  123. framextopmargin=10pt,
  124. framexbottommargin=7pt,
  125. xleftmargin=22pt,
  126. framexleftmargin=10pt,
  127. framesep=10pt,
  128. keepspaces=true
  129. }
  130.  
  131. lstdefinestyle{SQL}{%
  132. moredelim=**[is][hlstyle]{`}{`},%
  133. % moredelim=**[is][{btHL[fill=green!30,draw=red,dashed,thin]}]{@}{@}%
  134. }
  135.  
  136. letorig@lst@discretionary=lst@discretionary
  137. gdeflst@discretionary{%
  138. ifhl@active eh fi
  139. orig@lst@discretionary
  140. ifhl@active bh fi
  141. }
  142.  
  143. makeatother
  144.  
  145. begin{document}
  146.  
  147. begin{lstlisting}[style=SQL]
  148. documentclass{scrbook}
  149.  
  150. `usepackage{fontspec`}% #1
  151. setmainfont{`Latin Modern Sans Demi Cond`}% #2
  152.  
  153. usepackage{tikz}
  154. usetikzlibrary{shapes.misc}
  155.  
  156. begin{document}
  157.  
  158. begin{tikzpicture}
  159. `node[draw,rounded rectangle, rounded rectangle arc length=180] {Text};`% #3
  160. end{tikzpicture}
  161.  
  162. Press the `F1` key for help. Press the `tikz[baseline] draw node[anchor=base,draw,double,rounded corners] {{texttt{F11}}};` key for full screen.% #4
  163.  
  164. end{document}
  165. end{lstlisting}
  166.  
  167. end{document}
Add Comment
Please, Sign In to add comment