Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Particular environment LaTeX help

  1. Sep 8, 2006 #1
    Hey all!

    I'm trying to learn [tex]\LaTeX[/tex], and so far I'm doing fine. However, I would like to know if it is possible to be able to find out if a particular environment is in use at a certain point. Basically, I was wondering if something like:


    exists in LaTeX. Does anyone know?

    Thank you all!
    Last edited by a moderator: Oct 18, 2011
  2. jcsd
  3. Sep 8, 2006 #2
    why not:

    [tex]sin (math)[/tex]

  4. Sep 8, 2006 #3
    Hmmm... I don't think I understand how this command can help me finding out if the math environment is in use or not...
  5. Sep 10, 2006 #4
    I've never heard of such a thing. I don't really see a need for it. Why would you need something like that?
  6. Sep 10, 2006 #5
    I don't think any of us know what you're asking for, its not clear in the least. Are you talking about so you can tell if an environment is in use in a certain area while you're editing? Or are you talking about during compilation?
  7. Sep 10, 2006 #6
    You're right, perhaps that was not very clear. I want to be able to tell if an environment is in use in a certain area during compilation. Something that may return a boolean, to be used with some other package (I believe there is a if-then package or something like that... right?).
  8. Sep 10, 2006 #7
    As far as I know, the answer would be no, but there are a lot of custom home-made packages I'm not aware of. What are you trying to do that you would use this for?
  9. Sep 11, 2006 #8
    Call me lazy, but I'd like to make a new command to quickly display a norm, something like \newnorm{x+y} (to display [tex]\|x+y\|[/tex]), whether I'm in the math environment or not.
  10. Sep 11, 2006 #9


    User Avatar

    You can run latex "interactively" which will give you the verbose on what classes you're using - possibly also style files???

    However, style files are loaded from the preamble (\usepackage{}) - so you should be able to see from your tex file...
  11. Sep 11, 2006 #10

    use \ensuremath{}

    Thats what I use to set up macros to use in text. Something like


    Then I can use \Msun anywhere, in text or math environment and its automatically typeset as math.
  12. Sep 11, 2006 #11
    :!!) Exactly what I needed! Thank you!
  13. Sep 11, 2006 #12

    Welcome .
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook