I'm using tikz to compete in a codegolf question here. To get around having to write \typein a whole bunch of times I have \def~{\typein[}. Since nearly every \typein is prepended by ]{} so I would like to define ]{}\typein[ instead. However \def doesn't like curly braces for obvious reasons.

Is there some way I could add curly braces to my definition?

Here is my code if that helps at all:


1 Answer 1


There is no problem at all in using matching pairs of {..} which appears to be what you want. If I understand correctly your problem was hiding the ] which needs to close the optional argument.


  • @EpsilonNeighborhoodWatch not what you were trying to do but you asked about {} in a def which are no problem at all as shown here, and just vaguely hinted that you had tried to have the braces [ and ] for the optional \typein argument be in different macros, but that can not work. May 31, 2017 at 18:15
  • Sorry my last comment was a bit confusing. This does answer the question. I was just commenting about how the provided code was helpful not the post as a whole. May 31, 2017 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.