I am familiar with the newenvironment command, but I was wondering, how do I carry on the parameters that are used between [ ], i.e [bht!]?

I want to make a newfig and a newtab environment that will take care of some stuff that I don't want to redo everytime, i.e. center a figure or set text size to small.. I am lazy, and this can improve the readability of my tex document as well.

I know I can define them as normal parameters like this :


but these parameters are not always present, and do not necessarily have a default value. For example, the ! parameter has no default equivalent (or does it?). What can I do from this point?

EDIT: Using floats, I was able to do what I needed. Here is how I did it for tables :

  • Not particularly related, but R has a nice feature, where you can put "..." in the list of arguments a function takes, and then within the function use "..." to pass that list of arguments to other functions within it. – Seamus Oct 7 '10 at 16:08

Use the float package


It also provides a \newfloat command.


Would it work if you simply define a new environment with an optional argument and a sensible default?


Then you can write

... stuff ...

... stuff ...

... stuff ...
  • Yeah, that works. I remember trying to do this and not being able to, must have messed up somewhere :D – levesque Oct 13 '10 at 15:24
  • To be fair, I also misread your question the first time you posted it, and I was going to suggest some wild TeX-ish hack. Luckily, the problem was actually quite simple! – Juan A. Navarro Oct 13 '10 at 15:26

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.