Particular environment LaTeX help

  • Context: LaTeX 
  • Thread starter Thread starter juef
  • Start date Start date
  • Tags Tags
    Latex
Click For Summary

Discussion Overview

The discussion revolves around the use of LaTeX, specifically focusing on whether it is possible to determine if a particular environment, such as the math environment, is in use at a certain point during compilation. Participants explore potential commands or methods to achieve this functionality.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant inquires about the existence of a command like \isInUse{math} to check if the math environment is active.
  • Another participant suggests using sin (math) but does not clarify how it relates to checking the environment.
  • A different participant expresses confusion regarding the initial inquiry and questions the necessity of such a command.
  • One participant seeks clarification on whether the inquiry pertains to editing or compilation.
  • The original poster clarifies that they want to check the environment during compilation and mentions the possibility of using a boolean return value with an if-then package.
  • Another participant speculates that such a command likely does not exist but asks about the intended use case for it.
  • One participant expresses a desire to create a command for displaying norms that works regardless of the environment.
  • Another participant mentions running LaTeX interactively to obtain verbose output about the classes and style files in use.
  • One participant suggests using \ensuremath{} to create macros that can be used in both text and math environments.
  • A later reply confirms that the suggestion of using \ensuremath{} was helpful.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the existence of a command to check if an environment is in use. There are multiple competing views regarding the necessity and implementation of such functionality, and the discussion remains unresolved.

Contextual Notes

Some participants express uncertainty about the clarity of the original question and the specific use case for determining the environment status. There is also mention of custom packages that may not be widely known.

juef
Messages
27
Reaction score
0
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:

\isInUse{math}

exists in LaTeX. Does anyone know?

Thank you all!
 
Last edited by a moderator:
Physics news on Phys.org
why not:

[tex]sin (math)[/tex]

?
 
Mattara said:
why not:

[tex]sin (math)[/tex]

?
Hmmm... I don't think I understand how this command can help me finding out if the math environment is in use or not...
 
I've never heard of such a thing. I don't really see a need for it. Why would you need something like that?
 
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?
 
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?).
 
juef said:
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?).

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?
 
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.
 
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...
 
  • #10
juef said:
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.
use \ensuremath{}

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

\newcommand{\Msun}{\ensuremath{M_\odot}}

Then I can use \Msun anywhere, in text or math environment and its automatically typeset as math.
 
  • #11
franznietzsche said:
use \ensuremath{}

Thats what I use to set up macros to use in text.
:!) Exactly what I needed! Thank you!
 
  • #12
juef said:
:!) Exactly what I needed! Thank you!


Welcome .
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 11 ·
Replies
11
Views
6K
Replies
18
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K