timetable.sty 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. % timetable.sty - The LaTeX timetable stylesheet V1.4
  2. % http://www.planetk.de/index.php?title=Stundenplan
  3. %
  4. % Copyright (C) 2007-2009 Pascal Gwosdek
  5. % Modifications (C) 2008 Daniel Bader
  6. %
  7. % This program is free software; you can redistribute it and/or modify it
  8. % under the terms of the GNU General Public License as published by the
  9. % Free Software Foundation; either version 3 of the License, or (at your
  10. % option) any later version.
  11. %
  12. % This program is distributed in the hope that it will be useful, but
  13. % WITHOUT ANY WARRANTY; without even the implied warranty of
  14. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  15. % Public License for more details.
  16. %
  17. % You should have received a copy of the GNU General Public License along
  18. % with this program; if not, see <http://www.gnu.org/licenses/>.
  19. %
  20. \NeedsTeXFormat{LaTeX2e}
  21. \ProvidesPackage{timetable}
  22. \RequirePackage{ifthen, calc, color}
  23. % Preset the colors
  24. \definecolor{ttframecol1}{rgb}{0.8,0.8,0.8}
  25. \definecolor{ttframecol2}{rgb}{0.7,0.7,0.7}
  26. \definecolor{ttfontcolor}{rgb}{0.0,0.0,0.0}
  27. \definecolor{ttlinecol1}{rgb}{0.0,0.0,0.0}
  28. \definecolor{ttlinecol2}{rgb}{0.0,0.0,0.0}
  29. % Simple for loop construct as proposed by N. Setzer
  30. \newcommand{\@ttforloop}[5][1]
  31. {
  32. \setcounter{#2}{#3}
  33. \ifthenelse{#4}
  34. {
  35. #5
  36. \addtocounter{#2}{#1}
  37. \@ttforloop[#1]{#2}{\value{#2}}{#4}{#5}
  38. }
  39. {}
  40. }
  41. % SansSerif font
  42. \newcommand{\timetablefont}{\sffamily}
  43. \newcommand{\@ttfont}{\timetablefont\selectfont}
  44. % Dimensions
  45. \newlength{\@rowheight}
  46. \newlength{\@colwidth}
  47. \newcounter{@rowcount}
  48. \newcounter{@colcount}
  49. \newlength{\@textframe}
  50. \newlength{\@bottomspace}
  51. \newlength{\@totalheight}
  52. \newlength{\@totalwidth}
  53. \newlength{\@toprowheight}
  54. % Arbitrary stuff
  55. \newcounter{@timemarks}
  56. \newcounter{@daymarks}
  57. \newcounter{@topheight}
  58. \newcounter{@printtimestamps}
  59. \newlength{\@cornerradius}
  60. \newcounter{@frametype}
  61. \newcounter{@framevalign}
  62. % Predefines
  63. \setlength{\@cornerradius}{3pt}
  64. \setcounter{@frametype}2
  65. \setcounter{@framevalign}2
  66. \setlength{\@rowheight}{1.2cm}
  67. \setlength{\@colwidth}{2.8cm}
  68. \setlength{\@textframe}{0.8mm}
  69. \setlength{\@bottomspace}{8pt}
  70. \setcounter{@rowcount}9
  71. \setcounter{@colcount}5
  72. \setcounter{@topheight}{2}
  73. \setcounter{@printtimestamps}{0}
  74. \newcommand{\@bottomstyle}{\scriptsize}
  75. \newcommand{\@timestyle}{\tiny}
  76. % Event declarations
  77. \newlength{\@startposx}
  78. \newlength{\@startposy}
  79. \newlength{\@eventheight}
  80. \newlength{\@newcolwidth}
  81. \newlength{\@newrowheight}
  82. \newlength{\@newcolleft}
  83. \newlength{\@newrowtop}
  84. % Helpers
  85. \newcounter{@hourslot}
  86. \newcounter{@durationslots}
  87. \newcounter{@minutesperslot}
  88. \newcounter{@timetablehelp}
  89. \newcounter{@day}
  90. \newcounter{@column}
  91. \newcounter{@row}
  92. \newcounter{@hour}
  93. \newcounter{@minute}
  94. \newcounter{@minuteStep}
  95. \newcounter{@startHour}
  96. \newcounter{@startMinute}
  97. \newcounter{@endHour}
  98. \newcounter{@endMinute}
  99. \newcounter{@hoursset}
  100. \setcounter{@hoursset}{0}
  101. \newcounter{@hourzero}
  102. \newcommand{\seteventcornerradius}[1]
  103. {
  104. \setlength{\@cornerradius}{#1}
  105. \ifthenelse{\strip@pt\@cornerradius > 7}
  106. {
  107. \setlength{\@cornerradius}{7pt}
  108. }
  109. {
  110. \ifthenelse{\strip@pt\@cornerradius < 0}
  111. {
  112. \setlength{\@cornerradius}{0pt}
  113. }
  114. {}
  115. }
  116. }
  117. \newcommand{\settopheight}[1]
  118. {
  119. \addtocounter{@rowcount}{#1-\value{@topheight}}
  120. \setcounter{@topheight}{#1}
  121. }
  122. \newcommand{\setframetype}[2][c]
  123. {
  124. % Set frame type
  125. \ifthenelse{#2 < 1}
  126. {
  127. % Lines
  128. \setcounter{@frametype}{1}
  129. }
  130. {
  131. \ifthenelse{#2 > 2}
  132. {
  133. % Checkerboard
  134. \setcounter{@frametype}{2}
  135. }
  136. {
  137. \setcounter{@frametype}{#2}
  138. }
  139. }
  140. % Caption vertical alignment
  141. \ifthenelse{\equal{#1}{b}}
  142. {\setcounter{@framevalign}{1}}
  143. {\ifthenelse{\equal{#1}{t}}
  144. {\setcounter{@framevalign}{0}}
  145. {\setcounter{@framevalign}{2}}
  146. }
  147. }
  148. \newcommand{\setprinttimestamps}[1]
  149. {
  150. \setcounter{@printtimestamps}{#1}
  151. }
  152. \newcommand{\setbottomstyle}[1]
  153. {
  154. \renewcommand{\@bottomstyle}{#1}
  155. }
  156. \newcommand{\settimestyle}[1]
  157. {
  158. \renewcommand{\@timestyle}{#1}
  159. }
  160. \newcommand{\setbottomspace}[1]
  161. {
  162. \setlength{\@bottomspace}{#1}
  163. }
  164. \newcommand{\@fmtTime}[2]
  165. {
  166. % Arguments: {hour}{minute}
  167. \ifthenelse{\value{#1} < 10}{0}{}\arabic{#1}:\ifthenelse{\value{#2} < 10}{0}{}\arabic{#2}
  168. }
  169. \newcommand{\slotevent}[7]
  170. {
  171. % Arguments: {x}{y}{duration}{title}{lecturer}{place}{type}{textcolor}
  172. \renewcommand{\baselinestretch}{0.75}\normalsize
  173. \setlength{\@startposx}{#1\@colwidth+0.5pt}
  174. \setlength{\@startposy}{-#2\@rowheight-1.5pt}
  175. \setlength{\@eventheight}{#3\@rowheight-1pt}
  176. \addtolength{\@startposy}{-\@eventheight}
  177. \addtolength{\@startposx}{\@cornerradius}
  178. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\rule[-\dp\strutbox]{\@colwidth-1pt-2\@cornerradius}{\@eventheight}}}
  179. \addtolength{\@startposx}{-\@cornerradius}
  180. \addtolength{\@startposy}{\@cornerradius}
  181. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\rule[-\dp\strutbox]{\@colwidth-1pt}{\@eventheight-2\@cornerradius}}}
  182. \addtolength{\@startposy}{-\@cornerradius}
  183. \setlength{\@cornerradius}{2\@cornerradius}
  184. \ifthenelse{\strip@pt\@cornerradius > 0}
  185. {
  186. % Left rounded corners
  187. \addtolength{\@startposx}{.5\@cornerradius}
  188. \addtolength{\@startposy}{.5\@cornerradius-\dp\strutbox}
  189. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\circle*{\strip@pt\@cornerradius}}}
  190. \addtolength{\@startposy}{-.5\@cornerradius+\dp\strutbox}
  191. \addtolength{\@startposy}{-.5\@cornerradius-\dp\strutbox+\@eventheight}
  192. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\circle*{\strip@pt\@cornerradius}}}
  193. \addtolength{\@startposy}{.5\@cornerradius+\dp\strutbox-\@eventheight}
  194. \addtolength{\@startposx}{-.5\@cornerradius}
  195. % Right rounded corners
  196. \addtolength{\@startposx}{-.5\@cornerradius+\@colwidth-1pt}
  197. \addtolength{\@startposy}{.5\@cornerradius-\dp\strutbox}
  198. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\circle*{\strip@pt\@cornerradius}}}
  199. \addtolength{\@startposy}{-.5\@cornerradius+\dp\strutbox}
  200. \addtolength{\@startposy}{-.5\@cornerradius-\dp\strutbox+\@eventheight}
  201. \put(\strip@pt\@startposx,\strip@pt\@startposy){\textcolor{@timetable#7block}{\circle*{\strip@pt\@cornerradius}}}
  202. \addtolength{\@startposy}{.5\@cornerradius+\dp\strutbox-\@eventheight}
  203. \addtolength{\@startposx}{.5\@cornerradius-\@colwidth-1pt}
  204. }{}
  205. \setlength{\@cornerradius}{0.5\@cornerradius}
  206. \setlength{\@newrowheight}{\@rowheight}
  207. \addtolength{\@newrowheight}{-2\@textframe-1pt}
  208. \setlength{\@newcolwidth}{\@colwidth}
  209. \addtolength{\@newcolwidth}{-2\@textframe-1pt}
  210. \setlength{\@newrowtop}{-#2\@rowheight}
  211. \addtolength{\@newrowtop}{-2\@textframe}
  212. \setlength{\@newcolleft}{#1\@colwidth+.5pt}
  213. \addtolength{\@newcolleft}{\@textframe}
  214. \ifthenelse{\value{@hoursset} = 0}{\setcounter{@printtimestamps}{0}}{}
  215. % Title
  216. \addtolength{\@newrowtop}{-1pt}
  217. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop)
  218. {\begin{minipage}[t]{\@newcolwidth}%
  219. \@ttfont\raggedright\color{@timetable#7text}%
  220. \ifthenelse{\value{@printtimestamps} > 0}%
  221. {{\@timestyle \@fmtTime{@startHour}{@startMinute}}%
  222. \ifthenelse{\value{@printtimestamps} = 2}%
  223. {{\@timestyle -- \@fmtTime{@endHour}{@endMinute}}}%
  224. {}%
  225. \\}%
  226. {}%
  227. {#4}%
  228. \end{minipage}}
  229. \addtolength{\@newrowtop}{1pt}
  230. \renewcommand{\baselinestretch}{0.5}\normalsize
  231. \setlength{\@newrowtop}{-#2\@rowheight-#3\@rowheight}
  232. \addtolength{\@newrowtop}{2\@textframe + \@bottomspace}
  233. % Lecturer
  234. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop)
  235. {\begin{minipage}[t]{0.6\@newcolwidth}%
  236. \@ttfont\raggedright\color{@timetable#7text}{\@bottomstyle #5%
  237. \vphantom{A}}
  238. \ifthenelse{\value{@printtimestamps} = 1}%
  239. {{\@timestyle \@fmtTime{@endHour}{@endMinute}}}%
  240. {}%
  241. \end{minipage}}
  242. \setlength{\@newcolleft}{#1\@colwidth + \@colwidth}
  243. \addtolength{\@newcolleft}{-\@textframe-0.4\@newcolwidth}
  244. % Location
  245. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop)
  246. {\begin{minipage}[t]{0.4\@newcolwidth}%
  247. \@ttfont\raggedleft\color{@timetable#7text}{\@bottomstyle #6%
  248. \vphantom{A}}%
  249. \end{minipage}}
  250. \renewcommand{\baselinestretch}{1.0}\normalsize
  251. }
  252. \newcommand{\event}[7]
  253. {
  254. % Arguments: {@day}{@start}{@end}{title}{lecturer}{place}{type}
  255. % Use the time format, if hours are defined, and a slot number otherwise:
  256. \ifthenelse{\value{@hoursset} > 0}
  257. {
  258. \setcounter{@startHour}{#2 / 100}
  259. \setcounter{@startMinute}{#2 - #2 / 100 * 100}
  260. \setcounter{@endHour}{#3 / 100}
  261. \setcounter{@endMinute}{#3 - #3 / 100 * 100}
  262. \setcounter{@hourslot}{((#2 - \value{@hourzero}) / 100 * (60 / \value{@minutesperslot})) + 2 + ((#2 - #2 / 100 * 100) / \value{@minutesperslot})}
  263. \setcounter{@durationslots}{((#3 - \value{@hourzero}) / 100 * (60 / \value{@minutesperslot})) + 2 + ((#3 - #3 / 100 * 100) / \value{@minutesperslot}) - \value{@hourslot}}
  264. % Compensate for 24h wrap
  265. \ifthenelse{\value{@hourslot} < 0}{\addtocounter{@hourslot}{(24 * (60 / \value{@minutesperslot}))}}{}
  266. \addtocounter{@hourslot}{\value{@topheight}-2}
  267. }
  268. {
  269. \setcounter{@hourslot}{#2}
  270. \setcounter{@durationslots}{#3-#2}
  271. }
  272. \slotevent{#1}{\value{@hourslot}}{\value{@durationslots}}{#4}{#5}{#6}{#7}
  273. }
  274. \newcommand{\legend}[3]
  275. {
  276. % Arguments: <horizontal> <vertical> <text>
  277. % Lets you manually set slot contents (use this really rarely and
  278. % SEE: \daymark, \timemark )
  279. \setlength{\@newrowtop}{\@rowheight*(-#2+1)-\dp\strutbox}
  280. \setlength{\@newcolleft}{#1\@colwidth-\@colwidth}
  281. \ifthenelse{\value{@hoursset} = 0}
  282. {\setcounter{@minutesperslot}{60}}
  283. {}
  284. % Select frame type
  285. \ifthenelse{\value{@frametype} = 1}
  286. { % Lines
  287. \ifthenelse{#1 = 1}{\put(\strip@pt\@newcolleft,\strip@pt\@newrowtop){\textcolor{ttframecol2}{\rule{\@colwidth}{1pt}}}}{}
  288. \addtolength{\@newrowtop}{-\value{@topheight}\@rowheight}
  289. \addtolength{\@newcolleft}{-1pt}
  290. \ifthenelse{#2 = 1}{\put(\strip@pt\@newcolleft,\strip@pt\@newrowtop){\textcolor{ttframecol2}{\rule{1pt}{\value{@topheight}\@rowheight}}}}{}
  291. \addtolength{\@newcolleft}{1pt}
  292. \addtolength{\@newrowtop}{\value{@topheight}\@rowheight}
  293. }
  294. { % Checkerboard
  295. % Horizontal stripe
  296. \ifthenelse{#2 = 1}
  297. {\setcounter{@timetablehelp}{#1 * \real{0.5} * \real{2.0}}
  298. \ifthenelse{\value{@timetablehelp} = #1}
  299. {\addtolength{\@newrowtop}{-\value{@topheight}\@rowheight}
  300. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop)
  301. {\textcolor{ttframecol2}{\rule{\@colwidth}{\value{@topheight}\@rowheight}}}
  302. \addtolength{\@newrowtop}{\value{@topheight}\@rowheight}
  303. }
  304. {}
  305. }
  306. {}
  307. % Vertical stripe
  308. \ifthenelse{#1 = 1}
  309. {\setcounter{@timetablehelp}{(((#2-\value{@topheight}-1) * \value{@minutesperslot} / 120) * 2) - ((#2-\value{@topheight}-1) * \value{@minutesperslot} / 60)}
  310. \ifthenelse{\value{@timetablehelp} = 0}
  311. {\setcounter{@timetablehelp}{60 / \value{@minutesperslot}}
  312. \addtolength{\@newrowtop}{-\value{@timetablehelp}\@rowheight}
  313. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop)
  314. {\textcolor{ttframecol2}{\rule{\@colwidth}{\value{@timetablehelp}\@rowheight}}}
  315. \addtolength{\@newrowtop}{\value{@timetablehelp}\@rowheight}
  316. }
  317. {}
  318. }
  319. {}
  320. }
  321. % Print text
  322. \addtolength{\@newcolleft}{\@textframe}
  323. \addtolength{\@newrowtop}{-\@textframe-\heightof{\large #3}}
  324. % Optionally move caption to middle or bottom
  325. \ifthenelse{\value{@framevalign} > 0}
  326. {
  327. \ifthenelse{#1 = 1}
  328. {
  329. \addtolength{\@newrowtop}{(- \@rowheight * (60 / \value{@minutesperslot}) + 2\@textframe + \heightof{\Large #3})/\value{@framevalign}}
  330. }
  331. {
  332. \ifthenelse{#2 = 1}
  333. {
  334. \addtolength{\@newrowtop}{(- \value{@topheight}\@rowheight + 2\@textframe + \heightof{\Large #3})/\value{@framevalign}}
  335. }{}
  336. }
  337. }{}
  338. \put(\strip@pt\@newcolleft,\strip@pt\@newrowtop){\makebox{\textcolor{ttfontcolor}{\@ttfont\large #3}}}
  339. }
  340. \newcommand{\timemark}[1]
  341. {
  342. \stepcounter{@timemarks}
  343. \legend 1 {\value{@timemarks}} {#1}
  344. }
  345. \newcommand{\daymark}[1]
  346. {
  347. \stepcounter{@daymarks}
  348. \legend {\value{@daymarks}} 1 {#1}
  349. }
  350. \newcommand{\defineevent}[7]
  351. {
  352. \definecolor{@timetable#1block}{rgb}{#2, #3, #4}
  353. \definecolor{@timetable#1text} {rgb}{#5, #6, #7}
  354. }
  355. \newcommand{\printheading}[1]
  356. {
  357. {\@ttfont\LARGE #1}\par\vspace{5mm}\par
  358. }
  359. \newcommand{\setslotsize}[2]
  360. {
  361. % Arguments: <width> <height>
  362. % Defines the slot size
  363. \setlength{\@rowheight}{#2}
  364. \setlength{\@colwidth}{#1}
  365. }
  366. \newcommand{\setslotcount}[2]
  367. {
  368. % Arguments: <days> <hours per day>
  369. % Defines the number of slots in both dimensions
  370. \setcounter{@colcount}{#1}
  371. \setcounter{@rowcount}{#2+\value{@topheight}}
  372. \stepcounter{@colcount}
  373. }
  374. \newcommand{\settextframe}[1]
  375. {
  376. % Arguments: <width>
  377. % Defines the width of the border of each entry (i.e. the
  378. % distance between outer border and text)
  379. \setlength{\@textframe}{#1}
  380. }
  381. \newcommand{\hours}[3]
  382. {
  383. % Arguments: <start hour> <minute stepping> <print end time?>
  384. % Automatically sets the time slots to full hours, beginning with <start hour>
  385. \setcounter{@hoursset}{1}
  386. \setcounter{@hourzero}{(#1 * 100)}
  387. \setcounter{@hour}{#1}
  388. \setcounter{@minute}{0}
  389. \setcounter{@minuteStep}{#2}
  390. \setcounter{@minutesperslot}{\value{@minuteStep}}
  391. \@ttforloop{@row}{\value{@topheight}}{\value{@row} < \value{@rowcount}}
  392. {
  393. \ifthenelse{\value{@minute} = 0}{
  394. \timemark{\@fmtTime{@hour}{@minute}\ifthenelse{#3 > 0}{-\setcounter{@hour}{\value{@hour}+1}\@fmtTime{@hour}{@minute}\setcounter{@hour}{\value{@hour}-1}}{}}
  395. }{\stepcounter{@timemarks}}
  396. \addtocounter{@minute}{#2}
  397. \ifthenelse{\value{@minute} = 60}{\stepcounter{@hour}\setcounter{@minute}{0}}{}
  398. \ifthenelse{\value{@hour} > 23}{\addtocounter{@hour}{-24}}{}
  399. }
  400. }
  401. \newcommand{\englishdays}[1]
  402. {
  403. % Arguments: <number of start day>
  404. % Macro for the english week days
  405. \setcounter{@day}{#1}
  406. \@ttforloop{@column}{1}{\value{@column} < \value{@colcount}}
  407. {
  408. \ifthenelse{\equal{\value{@day}}1}{\daymark{Monday}}{}
  409. \ifthenelse{\equal{\value{@day}}2}{\daymark{Tuesday}}{}
  410. \ifthenelse{\equal{\value{@day}}3}{\daymark{Wednesday}}{}
  411. \ifthenelse{\equal{\value{@day}}4}{\daymark{Thursday}}{}
  412. \ifthenelse{\equal{\value{@day}}5}{\daymark{Friday}}{}
  413. \ifthenelse{\equal{\value{@day}}6}{\daymark{Saturday}}{}
  414. \ifthenelse{\equal{\value{@day}}7}{\daymark{Sunday}}{}
  415. \stepcounter{@day}
  416. \ifthenelse{\value{@day} > 7}{\addtocounter{@day}{-7}}{}
  417. }
  418. }
  419. \newcommand{\germandays}[1]
  420. {
  421. % Arguments: <number of start day>
  422. % Macro for the english week days
  423. \setcounter{@day}{#1}
  424. \@ttforloop{@column}{1}{\value{@column} < \value{@colcount}}
  425. {
  426. \ifthenelse{\equal{\value{@day}}1}{\daymark{Montag}}{}
  427. \ifthenelse{\equal{\value{@day}}2}{\daymark{Dienstag}}{}
  428. \ifthenelse{\equal{\value{@day}}3}{\daymark{Mittwoch}}{}
  429. \ifthenelse{\equal{\value{@day}}4}{\daymark{Donnerstag}}{}
  430. \ifthenelse{\equal{\value{@day}}5}{\daymark{Freitag}}{}
  431. \ifthenelse{\equal{\value{@day}}6}{\daymark{Samstag}}{}
  432. \ifthenelse{\equal{\value{@day}}7}{\daymark{Sonntag}}{}
  433. \stepcounter{@day}
  434. \ifthenelse{\value{@day} > 7}{\addtocounter{@day}{-7}}{}
  435. }
  436. }
  437. \newenvironment{timetable}%
  438. {\noindent%
  439. % Arguments: None
  440. % Starts a new timetable
  441. %
  442. % Set the new layout setting
  443. \setlength{\@totalheight}{-\value{@rowcount}\@rowheight}%
  444. \setlength{\@totalwidth}{\value{@colcount}\@colwidth}%
  445. %
  446. % Reset the counters
  447. \setcounter{@timemarks}{\value{@topheight}}%
  448. \setcounter{@daymarks}{1}%
  449. %
  450. % Minipage to correct bounding box
  451. \begin{minipage}[t][-\@totalheight]{\@totalwidth}
  452. %
  453. % Begin. Note the offset hack of the picture, this is to make it consistent to the old pstricks package.
  454. \begin{picture}(\strip@pt\@totalwidth,\strip@pt\@totalheight)(0,-\strip@pt\baselineskip)
  455. % Draw the grey frame
  456. \put(0,\strip@pt\@totalheight){\textcolor{ttframecol1}{\rule[-\dp\strutbox]{\@colwidth}{-\@totalheight}}}
  457. \setlength{\@toprowheight}{\value{@topheight}\@rowheight}
  458. \put(0,-\strip@pt\@toprowheight){\textcolor{ttframecol1}{\rule[-\dp\strutbox]{\@totalwidth}{\@toprowheight}}}
  459. }
  460. {
  461. % Draw the contours
  462. % Inner
  463. \addtolength{\@colwidth}{-1pt}
  464. \put(\strip@pt\@colwidth,-\strip@pt\@toprowheight){\textcolor{ttlinecol2}{\rule[-\dp\strutbox]{\@totalwidth-\@colwidth+1pt}{1pt}}}
  465. \put(\strip@pt\@colwidth,\strip@pt\@totalheight){\textcolor{ttlinecol2}{\rule[-\dp\strutbox]{1pt}{-\@totalheight-\@toprowheight}}}
  466. \addtolength{\@colwidth}{1pt}
  467. % Outer
  468. \put(0,0){\textcolor{ttlinecol1}{\rule[-\dp\strutbox]{\@totalwidth}{1pt}}}
  469. \put(0,\strip@pt\@totalheight){\textcolor{ttlinecol1}{\rule[-\dp\strutbox]{1pt}{-\@totalheight}}}
  470. \put(\strip@pt\@totalwidth,\strip@pt\@totalheight){\textcolor{ttlinecol1}{\rule[-\dp\strutbox]{1pt}{-\@totalheight+1pt}}}
  471. \addtolength{\@totalheight}{-0.5pt}
  472. \put(0,\strip@pt\@totalheight){\textcolor{ttlinecol1}{\rule[-\dp\strutbox]{\@totalwidth}{1pt}}}
  473. \addtolength{\@totalheight}{0.5pt}
  474. \end{picture}
  475. \end{minipage}
  476. }