Guest User

Untitled

a guest
Oct 19th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. documentclass{book}
  2.  
  3. usepackage[most]{tcolorbox}
  4. usepackage{varwidth}
  5. tcbuselibrary{skins,breakable}
  6.  
  7. usepackage{polyglossia}
  8. setmainlanguage{english}
  9.  
  10. newcommand{myboxnode}[2]{%
  11. node[fill=#2!5!white, draw=#2!75!black, line width=.5pt,
  12. below right, minimum height=2em,
  13. text width=.8cm, align=center,
  14. font=bfseries] at ([xshift=3mm,yshift=-1mm]frame.north east) {#1 thetcbcounter}}
  15.  
  16. tcbset{
  17. mystyle/.style 2 args={
  18. enhanced jigsaw, breakable,
  19. colback=white, colframe=white,
  20. sharp corners,
  21. boxrule = 0mm,
  22. top=2mm, bottom=2mm, left=2mm, right=2mm,
  23. % varwidth boxed title,
  24. tikznode boxed title={minimum width=textwidth/4-15mm-4.5mm},
  25. attach boxed title to top right={%
  26. xshift=.5mm,yshift=- tcboxedtitleheight+.5mm},
  27. boxed title style={%
  28. enhanced,
  29. sharp corners,
  30. colframe=#1!75!black,
  31. left=1mm, right=1mm,
  32. boxrule=.5mm},
  33. colbacktitle=#1!5!white,
  34. coltitle=black,
  35. extrude right by=-15mm,
  36. underlay unbroken and first={%
  37. myboxnode{#2}{#1};
  38. draw [#1!75!black,line width=.5mm]([shift={(15mm-.5pgflinewidth,-15mm+.5pgflinewidth)}]frame.north east)|-([shift={(-textwidth/4+15mm,+.5pgflinewidth)}]frame.north east);
  39. draw [#1!75!black,line width=.5mm]([shift={(.5pgflinewidth,-15mm+.5pgflinewidth)}]frame.north west)|-([shift={(textwidth/4,+.5pgflinewidth)}]frame.north west); },
  40. underlay unbroken and last={%
  41. draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south west)(textwidth/4,0)--(0,0);
  42. draw [#1!75!black,line width=.5mm]([xshift=.25mm,yshift=.25mm]frame.south west)--+(0,15mm);
  43. draw [#1!75!black,line width=.5mm]([xshift=14.75mm,yshift=.25mm]frame.south east)--+(0,15mm);
  44. draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south east)(3*textwidth/4,0)--(textwidth,0);
  45. },
  46. },
  47. mytitle/.style 2 args={
  48. code={%
  49. ifstrempty{#1}
  50. {tcbset{
  51. before upper={parshape 4
  52. 0pt dimexpr hsize-14mmrelax
  53. 0pt dimexpr hsize-14mmrelax
  54. 0pt dimexpr hsize-14mmrelax
  55. 0pt hsize}}}
  56. {tcbset{
  57. title={#1},
  58. before upper={vspace*{baselineskip}parshape 3
  59. 0pt dimexpr hsize-14mmrelax
  60. 0pt dimexpr hsize-14mmrelax
  61. 0pt hsize},
  62. underlay unbroken and last={
  63. draw [#2!75!black,line width=.5mm](frame.south east)--++(180:tcboxedtitlewidth-pgflinewidth);
  64. }}}
  65. },
  66. }
  67. }
  68.  
  69. newtcolorbox[auto counter]{proposition}[2][]{%
  70. mystyle={blue}{Prop},
  71. mytitle={#2}{blue},
  72. #1}
  73.  
  74. newtcolorbox[auto counter]{definition}[2][]{%
  75. mystyle={green}{Def},
  76. mytitle={#2}{green},
  77. #1}
  78.  
  79. begin{document}
  80. pagestyle{empty}
  81.  
  82. begin{definition}{}
  83. A non-titled definition
  84. vspace{2.2cm}
  85. end{definition}
  86.  
  87. begin{proposition}{A long title}
  88. A titled proposition
  89. vspace{2cm}
  90. end{proposition}
  91.  
  92. begin{definition}[height=2cm,label=Exlab]{A}
  93. A titled definition
  94. end{definition}
  95. ref{Exlab}
  96. end{document}
  97.  
  98. tcbsetmacrotoheightofnodemyheight{myboxnode{#2}{#1}},
  99. underlay unbroken and first={%
  100. myboxnode{#2}{#1};
  101. draw [#1!75!black,line width=.5mm]([shift={(15mm-.5pgflinewidth,-dimexprmyheight+.5pgflinewidth)}]frame.north east)|-([shift={(-textwidth/4+15mm,+.5pgflinewidth)}]frame.north east);
  102. draw [#1!75!black,line width=.5mm]([shift={(.5pgflinewidth,-dimexprmyheight+.5pgflinewidth)}]frame.north west)|-([shift={(textwidth/4,+.5pgflinewidth)}]frame.north west); },
  103. underlay unbroken and last={%
  104. draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south west)(textwidth/4,0)--(0,0);
  105. draw [#1!75!black,line width=.5mm]([xshift=.25mm,yshift=.25mm]frame.south west)--+(0,dimexprmyheight);
  106. draw [#1!75!black,line width=.5mm]([xshift=14.75mm,yshift=.25mm]frame.south east)--+(0,dimexprmyheight);
  107. draw [#1!75!black,line width=.5mm]([yshift=.25mm]frame.south east)(3*textwidth/4,0)--(textwidth,0);
  108. },
Add Comment
Please, Sign In to add comment