Particular environment LaTeX help

  • LaTeX
  • Thread starter juef
  • Start date
  • Tags
    Latex
In summary, you can use "ensuremath" to make sure your macros will work in both math and text environments.
  • #1
juef
27
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
  • #2
why not:

[tex]sin (math)[/tex]

?
 
  • #3
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...
 
  • #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?
 
  • #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?
 
  • #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?).
 
  • #7
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?
 
  • #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.
 
  • #9
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 .
 

1. What is LaTeX and how is it used in a particular environment?

LaTeX is a typesetting software commonly used for creating scientific and technical documents. It is particularly useful in environments where complex mathematical equations and symbols need to be accurately displayed, such as in academic papers or research reports.

2. What are the advantages of using LaTeX in a particular environment?

LaTeX offers precise and consistent formatting, making it ideal for creating professional-looking documents. It also has a wide range of customizable templates and packages, making it efficient for creating documents in a specific environment.

3. Are there any drawbacks to using LaTeX in a particular environment?

One potential drawback of using LaTeX is the learning curve. It can take some time to become familiar with the commands and syntax used in LaTeX. Additionally, it may not be the best option for documents that require a lot of formatting changes or frequent updates.

4. Can LaTeX be used for collaboration in a particular environment?

Yes, LaTeX has built-in features for collaboration, such as version control and the ability to merge changes from multiple contributors. Collaborators can also use the same templates and packages to ensure consistent formatting.

5. Is LaTeX suitable for non-technical documents in a particular environment?

While LaTeX is primarily used for technical documents, it can also be used for non-technical documents such as resumes, cover letters, and newsletters. However, it may not be the most efficient option for documents that require a lot of text formatting or design elements.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
18
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
20
Views
2K
Back
Top