Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{fontspec}
  3. usepackage{xparse}
  4. usepackage{tikz}
  5. newcounter{itemcounter}
  6. NewDocumentCommand{itemcount}{}{addtocounter{itemcounter}{1}arabic{itemcounter}}
  7. NewDocumentCommand{tmark}{ m }{tikz [remember picture,overlay] node [draw] (#1) {};} % used in definition of item
  8.  
  9. %Some fancy schmancy code to transform the following item:
  10. %item [item] Some text.
  11. %into this:
  12. %item [tmark{nodeprefixitemcount}] Some text. %expands to [tikz [remember picture, overlay] node [draw] (lista1) {};]
  13.  
  14. begin{document}
  15. begin{description}[nodeprefix=lista] % Not sure how to make a key or pass value of it to macro nodeprefix
  16. item [Apple] This is a fruit.
  17. item [Broccoli] This is a vegetable.
  18. end{description}
  19. begin{description}[nodeprefix=listb] % Not sure how to make a key or pass value of it to macro nodeprefix
  20. item [Silver] This is a solid.
  21. item [Water] This is a liquid.
  22. end{description}
  23. begin{description}[nodeprefix=listc] % Not sure how to make a key or pass value of it to macro nodeprefix
  24. item [Happiness] This is a state of being.
  25. item [Sadness] This is an unfortunate state of being.
  26. end{description}
  27. end{document}
  28.  
  29. node (lista1) {};
  30. node (lista2) {};
  31. node (listb1) {};
  32. node (listb2) {};
  33. node (listc1) {};
  34. node (listc2) {};
  35.  
  36. makeatletter % Redefine description list http://tex.stackexchange.com/a/66386/13552
  37. renewenvironment{description}
  38. {
  39. list{}{labelwidthz@ itemindent-leftmargin
  40. letmakelabeldescriptionlabel}
  41. }
  42. {
  43. endlist
  44. }
  45. letdescriptionlabelrelax
  46. newcommand*descriptionlabel[1]{hspacelabelsepnormalfontbfseries #1}
  47. makeatother
  48.  
  49. expandafterdefexpandafterdescriptionexpandafter{% http://tex.stackexchange.com/a/230316/13552
  50. description letolditemitem
  51. defitem[##1]{olditem[##1]mbox{}\}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement