Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- newcommand{qitem}{item?} %For the list of questions
- begin{enumerate}
- qitem Some question
- end{enumerate}
- documentclass{article}
- makeatletter
- defqitem{begingroupcatcode`^^M=12 qitem@}
- bgroupcatcode`^^M=12 %
- gdefqitem@#1^^M{item #1?endgroup}%
- egroup
- makeatother
- begin{document}
- begin{enumerate}
- qitem Some question
- qitem Some other question
- item Not a question
- end{enumerate}
- end{document}
- documentclass{article}
- newcommandqitem[1]{item #1?}
- begin{document}
- begin{enumerate}
- qitem{Is this a question}
- item This is an answer.
- qitem{Was that a question}
- qitem{Can this question not be answered}
- end{enumerate}
- end{document}
- documentclass{article}
- usepackage{collectbox}
- % Say we want to call this command for each item
- newcommandquestion[1]{#1?}
- makeatletter
- newifif@openbracket
- % Define environment similar to enumerate where item's are terminated with "?"
- newenvironment{enumerateq}%
- {%
- enumerate
- letorigitemitem
- defitem{%
- if@openbracketegroupendgroupfi%
- origitem
- begingroup@openbrackettruecollectbox*{question}bgroup
- }
- }%
- {if@openbracketegroupendgroupfi%
- endenumerate}
- makeatother
- begin{document}
- begin{enumerateq}
- item Is this a question
- item Was that a question% The new line is part of the content of the item. Comment out to suppress space.
- item Can this question not be answered%
- end{enumerateq}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement