Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. newcommand{qitem}{item?} %For the list of questions
  2. begin{enumerate}
  3. qitem Some question
  4. end{enumerate}
  5.  
  6. documentclass{article}
  7.  
  8. makeatletter
  9. defqitem{begingroupcatcode`^^M=12 qitem@}
  10. bgroupcatcode`^^M=12 %
  11. gdefqitem@#1^^M{item #1?endgroup}%
  12. egroup
  13. makeatother
  14.  
  15. begin{document}
  16. begin{enumerate}
  17. qitem Some question
  18. qitem Some other question
  19. item Not a question
  20. end{enumerate}
  21. end{document}
  22.  
  23. documentclass{article}
  24. newcommandqitem[1]{item #1?}
  25. begin{document}
  26. begin{enumerate}
  27. qitem{Is this a question}
  28. item This is an answer.
  29. qitem{Was that a question}
  30. qitem{Can this question not be answered}
  31. end{enumerate}
  32. end{document}
  33.  
  34. documentclass{article}
  35.  
  36. usepackage{collectbox}
  37.  
  38. % Say we want to call this command for each item
  39. newcommandquestion[1]{#1?}
  40.  
  41. makeatletter
  42. newifif@openbracket
  43.  
  44. % Define environment similar to enumerate where item's are terminated with "?"
  45. newenvironment{enumerateq}%
  46. {%
  47. enumerate
  48. letorigitemitem
  49. defitem{%
  50. if@openbracketegroupendgroupfi%
  51. origitem
  52. begingroup@openbrackettruecollectbox*{question}bgroup
  53. }
  54. }%
  55. {if@openbracketegroupendgroupfi%
  56. endenumerate}
  57. makeatother
  58.  
  59. begin{document}
  60. begin{enumerateq}
  61. item Is this a question
  62. item Was that a question% The new line is part of the content of the item. Comment out to suppress space.
  63. item Can this question not be answered%
  64. end{enumerateq}
  65. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement