Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.39 KB | None | 0 0
  1. documentclass{scrartcl}
  2. usepackage[T1]{fontenc}
  3. usepackage[utf8]{inputenc}
  4. usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
  5. ragged2e}
  6.  
  7. %% step 1: counter
  8. newcounter{snmark}
  9. setcounter{snmark}{0}
  10.  
  11.  
  12. %% step 2: hanging sidenotes, definition from tugboat
  13. makeatletter
  14. newcommand*{hangfrom}[1]{%
  15. setbox@tempboxahbox{{#1}}%
  16. hangindent wd@tempboxa
  17. noindentbox@tempboxa}
  18. makeatletter
  19.  
  20. %% step 3: define sidenote marks in the text
  21. newcommand{makesidenotemark}{%
  22. textsuperscript{thesnmark}
  23. }%
  24.  
  25.  
  26. %% step 4: and now the definition of sidenotes
  27. newcommand{sidenote}[1]{%
  28. refstepcounter{snmark}% Zähler erhöhen
  29. makesidenotemark{}% Nummer im Text setzen.
  30. makenote[paragraphs]{%
  31. hangfrom{%
  32. makebox[1em][l]{%
  33. thesnmark}
  34. }
  35. protectRaggedRight{} #1}% Text setzen im Rand
  36. }
  37.  
  38.  
  39. %% this is, except for the values (».7«) from scrguide.pdf to define
  40. %% the notecolumn.
  41.  
  42. newlength{paragraphscolwidth}
  43. AfterCalculatingTypearea{%
  44. setlength{paragraphscolwidth}{.4textwidth}%
  45. addtolength{paragraphscolwidth}{-marginparsep}%
  46. }
  47. recalctypearea
  48. DeclareNewNoteColumn[%
  49. position=oddsidemargin+1in
  50. +.7textwidth
  51. +marginparsep,
  52. width=paragraphscolwidth,
  53. font=footnotesize
  54. ]{paragraphs}
  55.  
  56.  
  57.  
  58.  
  59.  
  60. %% Delete all sidenotes:
  61. %renewcommand{sidenote}[1]{relax}
  62.  
  63. begin{document}
  64. begin{addmargin}[0pt]{.3textwidth}
  65. This is the text with a sidenote{See here.blindtext}.
  66. blindtext
  67.  
  68.  
  69. And here we have a second paragraph and a second
  70. sidenotesidenote{blindtext}.
  71. blindtext
  72.  
  73. And this is the big hit: We can have sidenotes which include
  74. pagebreaks!sidenote{Proof of concept: blindtext{}}
  75.  
  76.  
  77. syncwithnotecolumns[paragraphs]
  78.  
  79. And now we somewhere have a table:
  80. begin{table}[b]
  81. centering
  82. begin{tabular}{ll}
  83. Proofsidenote{From inside the float} & of concept\
  84. end{tabular}
  85. caption{This is a table}
  86. label{tab:table}
  87. end{table}
  88.  
  89. Besides that, we even can have tabulars in the marginsidenote{%
  90. Tabular in the margin:
  91.  
  92. protectbegin{tabular}{|l|l|}protecthline
  93. a& b\protecthline
  94. a& b\protecthline
  95. a& b\protecthline
  96. protectend{tabular}
  97. }, but they have
  98. to be narrow and well protected.
  99.  
  100. end{addmargin}
  101.  
  102.  
  103. end{document}
  104.  
  105. usepackage{environ}
  106. makeatletter
  107. NewEnviron{margintable}{%
  108. expandafter@margintableexpandafter{BODY}%
  109. }
  110. newcommand*@margintable[1]{%
  111. makenote[paragraphs]{%
  112. protectbegin{nonfloattable}detokenize{#1}protectend{nonfloattable}
  113. }%
  114. }
  115. newenvironment{nonfloattable}{%
  116. parnoindentbegin{minipage}{linewidth}
  117. def@captype{table}%
  118. }{%
  119. end{minipage}par
  120. }
  121.  
  122. documentclass{scrartcl}
  123. usepackage[T1]{fontenc}
  124. usepackage[utf8]{inputenc}
  125. usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
  126. ragged2e}
  127.  
  128. %% step 1: counter
  129. newcounter{snmark}
  130. setcounter{snmark}{0}
  131.  
  132.  
  133. %% step 2: hanging sidenotes, definition from tugboat
  134. makeatletter
  135. newcommand*{hangfrom}[1]{%
  136. setbox@tempboxahbox{{#1}}%
  137. hangindent wd@tempboxa
  138. noindentbox@tempboxa}
  139. makeatletter
  140.  
  141. %% step 3: define sidenote marks in the text
  142. newcommand{makesidenotemark}{%
  143. textsuperscript{thesnmark}
  144. }%
  145.  
  146.  
  147. %% step 4: and now the definition of sidenotes
  148. newcommand{sidenote}[1]{%
  149. refstepcounter{snmark}% Zähler erhöhen
  150. makesidenotemark{}% Nummer im Text setzen.
  151. makenote[paragraphs]{%
  152. hangfrom{%
  153. makebox[1em][l]{%
  154. thesnmark}
  155. }
  156. protectRaggedRight{} #1}% Text setzen im Rand
  157. }
  158.  
  159.  
  160. %% this is, except for the values (».7«) from scrguide.pdf to define
  161. %% the notecolumn.
  162.  
  163. newlength{paragraphscolwidth}
  164. AfterCalculatingTypearea{%
  165. setlength{paragraphscolwidth}{.4textwidth}%
  166. addtolength{paragraphscolwidth}{-marginparsep}%
  167. }
  168. recalctypearea
  169. DeclareNewNoteColumn[%
  170. position=oddsidemargin+1in
  171. +.7textwidth
  172. +marginparsep,
  173. width=paragraphscolwidth,
  174. font=footnotesize
  175. ]{paragraphs}
  176.  
  177. usepackage{environ}
  178. makeatletter
  179. NewEnviron{margintable}{%
  180. expandafter@margintableexpandafter{BODY}%
  181. }
  182. newcommand*@margintable[1]{%
  183. globalletlabeltoset@empty
  184. @tempcntavalue{table}%
  185. begin{lrbox}{@tempboxa}
  186. begin{minipage}{paragraphscolwidth}
  187. deflabel##1{%
  188. xdeflabeltoset{%
  189. labeltoset
  190. noexpandprotected@writenoexpand@auxout{}{%
  191. noexpandstringnoexpandnewlabel{##1}{{@currentlabel}{thepage}}}%
  192. }%
  193. }%
  194. def@captype{table}%
  195. #1%
  196. end{minipage}
  197. end{lrbox}%
  198. setcounter{table}{@tempcnta}%
  199. makenote[paragraphs]{%
  200. protectbegin{nonfloattable}detokenize{#1}protectend{nonfloattable}
  201. }%
  202. labeltoset
  203. }
  204. newenvironment{nonfloattable}{%
  205. parnoindentbegin{minipage}{linewidth}
  206. def@captype{table}%
  207. }{%
  208. end{minipage}par
  209. }
  210.  
  211. %% Delete all sidenotes:
  212. %renewcommand{sidenote}[1]{relax}
  213.  
  214. begin{document}
  215. begin{addmargin}[0pt]{.3textwidth}
  216. This is the text with a sidenote{See here.blindtext}.
  217. blindtext
  218.  
  219.  
  220. And here we have a second paragraph and a second
  221. sidenotesidenote{blindtext}.
  222. blindtext
  223.  
  224. And this is the big hit: We can have sidenotes which include
  225. pagebreaks!sidenote{Proof of concept: blindtext{}}
  226.  
  227.  
  228. syncwithnotecolumns[paragraphs]
  229.  
  230. And now we somewhere have a table:
  231. begin{table}[b]
  232. centering
  233. begin{tabular}{ll}
  234. Proofsidenote{From inside the float} & of concept\
  235. end{tabular}
  236. caption{This is a table}
  237. label{tab:table}
  238. end{table}
  239.  
  240. Besides that, we even can have tabulars in the marginsidenote{%
  241. Tabular in the margin:
  242.  
  243. protectbegin{tabular}{|l|l|}protecthline
  244. a& b\protecthline
  245. a& b\protecthline
  246. a& b\protecthline
  247. protectend{tabular}
  248. }, but they have
  249. to be narrow and well protected.
  250.  
  251. begin{margintable}
  252. centering
  253. begin{tabular}{|l|l|}hline
  254. a& b\hline
  255. a& b\hline
  256. a& b\hline
  257. end{tabular}
  258. caption{This is a second table}%
  259. label{tab:secondtable}
  260. end{margintable}
  261.  
  262. See also table~ref{tab:secondtable}.
  263.  
  264. end{addmargin}
  265.  
  266. listoftables
  267.  
  268. end{document}
  269.  
  270. documentclass{scrartcl}
  271. usepackage[T1]{fontenc}
  272. usepackage[utf8]{inputenc}
  273. usepackage{scrlayer-scrpage, scrlayer-notecolumn, lmodern, blindtext,
  274. ragged2e}
  275.  
  276. %% step 1: counter
  277. newcounter{snmark}
  278. setcounter{snmark}{0}
  279.  
  280.  
  281. %% step 2: hanging sidenotes, definition from tugboat
  282. makeatletter
  283. newcommand*{hangfrom}[1]{%
  284. setbox@tempboxahbox{{#1}}%
  285. hangindent wd@tempboxa
  286. noindentbox@tempboxa}
  287. makeatletter
  288.  
  289. %% step 3: define sidenote marks in the text
  290. newcommand{makesidenotemark}{%
  291. textsuperscript{thesnmark}%
  292. }%
  293.  
  294.  
  295. %% step 4: and now the definition of sidenotes
  296. newcommand{sidenote}[1]{%
  297. refstepcounter{snmark}% Zähler erhöhen
  298. makesidenotemark{}% Nummer im Text setzen.
  299. makenote[paragraphs]{%
  300. hangfrom{%
  301. makebox[1em][l]{%
  302. thesnmark}%
  303. }%
  304. protectRaggedRightdetokenize{#1}}% Text setzen im Rand
  305. }
  306.  
  307.  
  308. %% this is, except for the values (».7«) from scrguide.pdf to define
  309. %% the notecolumn.
  310.  
  311. newlength{paragraphscolwidth}
  312. AfterCalculatingTypearea{%
  313. setlength{paragraphscolwidth}{.4textwidth}%
  314. addtolength{paragraphscolwidth}{-marginparsep}%
  315. }
  316. recalctypearea
  317. DeclareNewNoteColumn[%
  318. position=oddsidemargin+1in
  319. +.7textwidth
  320. +marginparsep,
  321. width=paragraphscolwidth,
  322. font=footnotesize
  323. ]{paragraphs}
  324.  
  325. usepackage{environ}
  326. makeatletter
  327. NewEnviron{margintable}{%
  328. expandafter@margintableexpandafter{BODY}%
  329. }
  330. newcommand*@margintable[1]{%
  331. makenote*[paragraphs]{%
  332. begin{nonfloattable}#1end{nonfloattable}%
  333. }%
  334. }
  335. newenvironment{nonfloattable}{%
  336. parnoindentbegin{minipage}{linewidth}
  337. def@captype{table}%
  338. }{%
  339. end{minipage}par
  340. }
  341. usepackage{makeidx}
  342.  
  343. %% Delete all sidenotes:
  344. %renewcommand{sidenote}[1]{relax}
  345.  
  346. begin{document}
  347. begin{addmargin}[0pt]{.3textwidth}
  348. This is the text with a sidenotesidenote{See here.blindtext}.
  349. blindtext
  350.  
  351.  
  352. And here we have a second paragraph and a second
  353. sidenotesidenote{blindtext}.
  354. blindtext
  355.  
  356. And this is the big hit: We can have sidenotes which include
  357. pagebreaks!sidenote{Proof of concept: blindtext{}}
  358.  
  359.  
  360. syncwithnotecolumns[paragraphs]
  361.  
  362. And now we somewhere have a table:
  363. begin{table}[b]
  364. centering
  365. begin{tabular}{ll}
  366. Proofsidenote{From inside the float} & of concept\
  367. end{tabular}
  368. caption{This is a table}
  369. label{tab:table}
  370. end{table}
  371.  
  372. Besides that, we even can have tabulars in the marginsidenote{%
  373. Tabular in the margin:
  374.  
  375. begin{tabular}{|l|l|}hline
  376. a& b\hline
  377. a& b\hline
  378. a& b\hline
  379. end{tabular}%
  380. }, but they have
  381. to be narrow and well protected.
  382.  
  383. begin{margintable}
  384. centering
  385. begin{tabular}{|l|l|}hline
  386. a& b\hline
  387. a& b\hline
  388. a& b\hline
  389. end{tabular}
  390. caption{This is a second table}%
  391. label{tab:secondtable}
  392. end{margintable}
  393.  
  394. See also table~ref{tab:secondtable}.
  395. listoftables
  396.  
  397. end{addmargin}
  398.  
  399.  
  400. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement