TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a drawback of defining and using a \newcommand instead of \begin{something}. e.g. if I use

\newcommand{btkz}{\begin{tikzpicture}} \newcommand{etkz}{\end{tikzpicture}} \btkz \node{Hello World}; \etkz

Actually I am working on a Beamer presentation, and I use tikzpicture and itemize very often, I am really tired of typing in \begin{} \end{} stuff every time. And I am really lazy (I believe you have guessed by now how much). So does it hurt to use \btkz and \etkz as above?? Would it lead me into some trouble at som stage?

share|improve this question
Perhaps better \newcommand\btkz[1][]{\begin{tikzpicture}[#1]} so \btkz has an optional argument to pass options to the tikzpicture. – Gonzalo Medina Aug 14 '14 at 2:12
This is just a tip: do whatever you want and after you have finished, have your TeX editor simply replace all occurrences of \btkz with \begin{tikzpicture}, etc., to preserve the mark-up structure. – n.r. Aug 14 '14 at 2:16
@GonzaloMedina That changes nothing: with the OP's definition \btkz[...] would also expand to \begin{tikzpicture}[...]. I would say it's mostly a matter of taste. – Bruno Le Floch Aug 16 '14 at 21:30
up vote 10 down vote accepted

Many people set up their editor to do such things automatically. Personally, I use snippets inside vim, which I highly recommend, for such things. For example, to write a tikzpicture environment I just type tikz and then hit <tab>. This inserts the full environment and it is much faster than your two shortcuts. There are similar tools for most editors.

The main disadvantages of defining such shortcuts that I can see are:

  • They make it harder for other people to read your tex file
  • Some journals will complain and some do not accept papers written with them (with the AMS, for example, non-standard macros can delay the publication of your paper)
  • They can be particularly problematic with collaborators
  • If you don't define your shortcuts carefully then you might accidentally break something. For example, as Gonzalo points out above, your tikz shortcut does not accept optional arguments, so even though you haven't broken anything you have lost functionality
  • Shortcuts can often lead to even more cryptic error messages that are harder to track down than the "standard" cryptic error messages that TeX produces.
share|improve this answer
But there is also advantages. The TeX source is intended to human, no only to machine. Human can read the code with minimal braces and nested LaTeX environments much more comfortable. And about cryptic errors: LaTeX hide the TeX complexity in its manual but TeX errors are printed. So, each such error is cryptic for average LaTeX user. For example missing \cr inserted. Where is \cr in LaTeX manual? – wipet Aug 14 '14 at 6:21
@wipet I don't disagree. I used to use my own custom made (and hence idiosyncratic!), self-closing macros to construct proof and theorem-like environments. They were very compact and readable and very easy (for me) to use. Unfortunately they weren't popular with my coathors, or with journals, so I stopped using them. In fact, this is the source of my list of disadvantages listed above. – Andrew Aug 14 '14 at 9:35
@Andrew Hey Andrew .. I am not sure if you will read this comment .. but your suggestion of using vim + snippets does work like a charm .. thanks a lot .. actually with my defense date on my head i was stuck with texmaker and really did not have time to try something new ... and then it took me a while to get the vim et al get going on mac ... but since i got the essence now ... Thanks a lot ... – user3750702 Aug 26 '14 at 2:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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