Typing CO_2 easily The Next CEO of Stack Overflownewcommand gives errors in math mode (with or without arguments)Macro shortcut for mathrm commandHow to implement expandbefore, similarly to expandafter?fancylabel not incrementing counter if table is include with ltxtableHow to typeset a word containing both Latin and Greek letters?
What connection does MS Office have to Netscape Navigator?
Is it possible to replace duplicates of a character with one character using tr
Why isn't the Mueller report being released completely and unredacted?
Ubuntu shell scripting
Would a completely good Muggle be able to use a wand?
Is it okay to majorly distort historical facts while writing a fiction story?
Can MTA send mail via a relay without being told so?
Plot of histogram similar to output from @risk
Is micro rebar a better way to reinforce concrete than rebar?
Why this way of making earth uninhabitable in Interstellar?
Running a General Election and the European Elections together
Is there a way to save my career from absolute disaster?
What benefits would be gained by using human laborers instead of drones in deep sea mining?
How does Madhvacharya interpret Bhagavad Gita sloka 18.66?
Is there a difference between "Fahrstuhl" and "Aufzug"
Is French Guiana a (hard) EU border?
Math-accent symbol over parentheses enclosing accented symbol (amsmath)
How to place nodes around a circle from some initial angle?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Decomposition of product of two Plucker coordinates
Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?
Arranging cats and dogs - what is wrong with my approach
What happened in Rome, when the western empire "fell"?
Writing differences on a blackboard
Typing CO_2 easily
The Next CEO of Stack Overflownewcommand gives errors in math mode (with or without arguments)Macro shortcut for mathrm commandHow to implement expandbefore, similarly to expandafter?fancylabel not incrementing counter if table is include with ltxtableHow to typeset a word containing both Latin and Greek letters?
I'm writing my dissertation and that involves typing a lot of $mathrmCO_2$
. I'd like to make a macro for it that's a lot easier to type, but if I put newcommandco2mathrmCO_2
, for example, it gives me the error that mathrm
can only be used in math mode. But using newcommandco2$mathrmCO_2$
doesn't work either.
Is there a way for me to make a macro that makes typing CO_2 easier, even if it doesn't use mathrm
?
chemistry
add a comment |
I'm writing my dissertation and that involves typing a lot of $mathrmCO_2$
. I'd like to make a macro for it that's a lot easier to type, but if I put newcommandco2mathrmCO_2
, for example, it gives me the error that mathrm
can only be used in math mode. But using newcommandco2$mathrmCO_2$
doesn't work either.
Is there a way for me to make a macro that makes typing CO_2 easier, even if it doesn't use mathrm
?
chemistry
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
7
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36
add a comment |
I'm writing my dissertation and that involves typing a lot of $mathrmCO_2$
. I'd like to make a macro for it that's a lot easier to type, but if I put newcommandco2mathrmCO_2
, for example, it gives me the error that mathrm
can only be used in math mode. But using newcommandco2$mathrmCO_2$
doesn't work either.
Is there a way for me to make a macro that makes typing CO_2 easier, even if it doesn't use mathrm
?
chemistry
I'm writing my dissertation and that involves typing a lot of $mathrmCO_2$
. I'd like to make a macro for it that's a lot easier to type, but if I put newcommandco2mathrmCO_2
, for example, it gives me the error that mathrm
can only be used in math mode. But using newcommandco2$mathrmCO_2$
doesn't work either.
Is there a way for me to make a macro that makes typing CO_2 easier, even if it doesn't use mathrm
?
chemistry
chemistry
edited Mar 20 at 11:03
Phelype Oleinik
24.6k54688
24.6k54688
asked Mar 20 at 2:02
HayleyHayley
885
885
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
7
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36
add a comment |
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
7
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
7
7
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36
add a comment |
4 Answers
4
active
oldest
votes
I'm not sure if this is a question about how to use co2
as a macro name or just a question about how to subscript in text mode. If you use coo
, the macro
newcommandcooensuremathmathrmCO_2
works fine in both text and math mode. If you're only planning to use the macro in text mode, COtextsubscript2
works.
documentclassarticle
newcommandcooensuremathmathrmCO_2
newcommandcoooCOtextsubscript2
begindocument
With ensuremath: Text coo and math $coo$ both look fine.
With textsubscript: Text cooo is fine, but math $cooo$ isn't.
enddocument
Don't forget the trainling and space after the call in text mode.
1
Or usecoo
in text mode, which avoids worries about the space getting eaten by something.
– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
Especially when using macros, I think that using xspace is really convenient. You put anxspace
at the end of your macro and it will decide if a space is necessary or not.
– Ian
Mar 21 at 7:23
add a comment |
You want easy?
documentclassarticle
usepackagechemformula
begindocument
chCO2
enddocument
21
For completeness, you might mention alsomhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning thatchemformula
(and I believemhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.
– Dustin Wheeler
Mar 27 at 12:59
add a comment |
I would use the mhchem
package. It makes a lot of chemistry things easier, including reactions as well as formulas.
Put the line
usepackagemhchem
in the header section of your document, and then CO2 is just ceCO2
. You can use that in math mode or text mode, it works either way. Here are some examples of other formulae from the package documentation, to give an idea of what you can do. (Note from the very first example how easy it is to write a simple reaction.)
(Note also that, as mentioned in John Kormylo's answer, there is also a package chemformula
. It seems to be very similar, and allows you to do the same things in very similar ways. It is a more recent package, but I have no experience with it.)
add a comment |
Using isotope
package with the macro cotwo
you can write easily and quickly CO_2
:
documentclassarticle
usepackageisotope
newcommandcotwo$isotopeCO_2$
begindocument
cotwo
enddocument
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480391%2ftyping-co-2-easily%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I'm not sure if this is a question about how to use co2
as a macro name or just a question about how to subscript in text mode. If you use coo
, the macro
newcommandcooensuremathmathrmCO_2
works fine in both text and math mode. If you're only planning to use the macro in text mode, COtextsubscript2
works.
documentclassarticle
newcommandcooensuremathmathrmCO_2
newcommandcoooCOtextsubscript2
begindocument
With ensuremath: Text coo and math $coo$ both look fine.
With textsubscript: Text cooo is fine, but math $cooo$ isn't.
enddocument
Don't forget the trainling and space after the call in text mode.
1
Or usecoo
in text mode, which avoids worries about the space getting eaten by something.
– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
Especially when using macros, I think that using xspace is really convenient. You put anxspace
at the end of your macro and it will decide if a space is necessary or not.
– Ian
Mar 21 at 7:23
add a comment |
I'm not sure if this is a question about how to use co2
as a macro name or just a question about how to subscript in text mode. If you use coo
, the macro
newcommandcooensuremathmathrmCO_2
works fine in both text and math mode. If you're only planning to use the macro in text mode, COtextsubscript2
works.
documentclassarticle
newcommandcooensuremathmathrmCO_2
newcommandcoooCOtextsubscript2
begindocument
With ensuremath: Text coo and math $coo$ both look fine.
With textsubscript: Text cooo is fine, but math $cooo$ isn't.
enddocument
Don't forget the trainling and space after the call in text mode.
1
Or usecoo
in text mode, which avoids worries about the space getting eaten by something.
– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
Especially when using macros, I think that using xspace is really convenient. You put anxspace
at the end of your macro and it will decide if a space is necessary or not.
– Ian
Mar 21 at 7:23
add a comment |
I'm not sure if this is a question about how to use co2
as a macro name or just a question about how to subscript in text mode. If you use coo
, the macro
newcommandcooensuremathmathrmCO_2
works fine in both text and math mode. If you're only planning to use the macro in text mode, COtextsubscript2
works.
documentclassarticle
newcommandcooensuremathmathrmCO_2
newcommandcoooCOtextsubscript2
begindocument
With ensuremath: Text coo and math $coo$ both look fine.
With textsubscript: Text cooo is fine, but math $cooo$ isn't.
enddocument
Don't forget the trainling and space after the call in text mode.
I'm not sure if this is a question about how to use co2
as a macro name or just a question about how to subscript in text mode. If you use coo
, the macro
newcommandcooensuremathmathrmCO_2
works fine in both text and math mode. If you're only planning to use the macro in text mode, COtextsubscript2
works.
documentclassarticle
newcommandcooensuremathmathrmCO_2
newcommandcoooCOtextsubscript2
begindocument
With ensuremath: Text coo and math $coo$ both look fine.
With textsubscript: Text cooo is fine, but math $cooo$ isn't.
enddocument
Don't forget the trainling and space after the call in text mode.
answered Mar 20 at 13:13
Sandy GSandy G
4,3201635
4,3201635
1
Or usecoo
in text mode, which avoids worries about the space getting eaten by something.
– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
Especially when using macros, I think that using xspace is really convenient. You put anxspace
at the end of your macro and it will decide if a space is necessary or not.
– Ian
Mar 21 at 7:23
add a comment |
1
Or usecoo
in text mode, which avoids worries about the space getting eaten by something.
– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
Especially when using macros, I think that using xspace is really convenient. You put anxspace
at the end of your macro and it will decide if a space is necessary or not.
– Ian
Mar 21 at 7:23
1
1
Or use
coo
in text mode, which avoids worries about the space getting eaten by something.– David Richerby
Mar 20 at 20:35
Or use
coo
in text mode, which avoids worries about the space getting eaten by something.– David Richerby
Mar 20 at 20:35
Perfect, thank you!
– Hayley
Mar 21 at 0:36
Perfect, thank you!
– Hayley
Mar 21 at 0:36
3
3
Especially when using macros, I think that using xspace is really convenient. You put an
xspace
at the end of your macro and it will decide if a space is necessary or not.– Ian
Mar 21 at 7:23
Especially when using macros, I think that using xspace is really convenient. You put an
xspace
at the end of your macro and it will decide if a space is necessary or not.– Ian
Mar 21 at 7:23
add a comment |
You want easy?
documentclassarticle
usepackagechemformula
begindocument
chCO2
enddocument
21
For completeness, you might mention alsomhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning thatchemformula
(and I believemhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.
– Dustin Wheeler
Mar 27 at 12:59
add a comment |
You want easy?
documentclassarticle
usepackagechemformula
begindocument
chCO2
enddocument
21
For completeness, you might mention alsomhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning thatchemformula
(and I believemhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.
– Dustin Wheeler
Mar 27 at 12:59
add a comment |
You want easy?
documentclassarticle
usepackagechemformula
begindocument
chCO2
enddocument
You want easy?
documentclassarticle
usepackagechemformula
begindocument
chCO2
enddocument
answered Mar 20 at 3:23
John KormyloJohn Kormylo
46.1k22672
46.1k22672
21
For completeness, you might mention alsomhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning thatchemformula
(and I believemhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.
– Dustin Wheeler
Mar 27 at 12:59
add a comment |
21
For completeness, you might mention alsomhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning thatchemformula
(and I believemhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.
– Dustin Wheeler
Mar 27 at 12:59
21
21
For completeness, you might mention also
mhchem
– egreg
Mar 20 at 9:04
For completeness, you might mention also
mhchem
– egreg
Mar 20 at 9:04
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
ChemFormula is part of the excellent ChemMacros suite by clemens. If you continue writing documents in the field of chemistry, I’d highly recommend spending some time skimming the documentation.
– Dustin Wheeler
Mar 27 at 12:53
Also worth mentioning that
chemformula
(and I believe mhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.– Dustin Wheeler
Mar 27 at 12:59
Also worth mentioning that
chemformula
(and I believe mhchem
) are robust with respect to math mode (i.e., no need to modify the code inside vs. outside math environments.– Dustin Wheeler
Mar 27 at 12:59
add a comment |
I would use the mhchem
package. It makes a lot of chemistry things easier, including reactions as well as formulas.
Put the line
usepackagemhchem
in the header section of your document, and then CO2 is just ceCO2
. You can use that in math mode or text mode, it works either way. Here are some examples of other formulae from the package documentation, to give an idea of what you can do. (Note from the very first example how easy it is to write a simple reaction.)
(Note also that, as mentioned in John Kormylo's answer, there is also a package chemformula
. It seems to be very similar, and allows you to do the same things in very similar ways. It is a more recent package, but I have no experience with it.)
add a comment |
I would use the mhchem
package. It makes a lot of chemistry things easier, including reactions as well as formulas.
Put the line
usepackagemhchem
in the header section of your document, and then CO2 is just ceCO2
. You can use that in math mode or text mode, it works either way. Here are some examples of other formulae from the package documentation, to give an idea of what you can do. (Note from the very first example how easy it is to write a simple reaction.)
(Note also that, as mentioned in John Kormylo's answer, there is also a package chemformula
. It seems to be very similar, and allows you to do the same things in very similar ways. It is a more recent package, but I have no experience with it.)
add a comment |
I would use the mhchem
package. It makes a lot of chemistry things easier, including reactions as well as formulas.
Put the line
usepackagemhchem
in the header section of your document, and then CO2 is just ceCO2
. You can use that in math mode or text mode, it works either way. Here are some examples of other formulae from the package documentation, to give an idea of what you can do. (Note from the very first example how easy it is to write a simple reaction.)
(Note also that, as mentioned in John Kormylo's answer, there is also a package chemformula
. It seems to be very similar, and allows you to do the same things in very similar ways. It is a more recent package, but I have no experience with it.)
I would use the mhchem
package. It makes a lot of chemistry things easier, including reactions as well as formulas.
Put the line
usepackagemhchem
in the header section of your document, and then CO2 is just ceCO2
. You can use that in math mode or text mode, it works either way. Here are some examples of other formulae from the package documentation, to give an idea of what you can do. (Note from the very first example how easy it is to write a simple reaction.)
(Note also that, as mentioned in John Kormylo's answer, there is also a package chemformula
. It seems to be very similar, and allows you to do the same things in very similar ways. It is a more recent package, but I have no experience with it.)
edited Mar 21 at 9:25
answered Mar 21 at 9:11
NathanielNathaniel
1,05721226
1,05721226
add a comment |
add a comment |
Using isotope
package with the macro cotwo
you can write easily and quickly CO_2
:
documentclassarticle
usepackageisotope
newcommandcotwo$isotopeCO_2$
begindocument
cotwo
enddocument
add a comment |
Using isotope
package with the macro cotwo
you can write easily and quickly CO_2
:
documentclassarticle
usepackageisotope
newcommandcotwo$isotopeCO_2$
begindocument
cotwo
enddocument
add a comment |
Using isotope
package with the macro cotwo
you can write easily and quickly CO_2
:
documentclassarticle
usepackageisotope
newcommandcotwo$isotopeCO_2$
begindocument
cotwo
enddocument
Using isotope
package with the macro cotwo
you can write easily and quickly CO_2
:
documentclassarticle
usepackageisotope
newcommandcotwo$isotopeCO_2$
begindocument
cotwo
enddocument
answered Mar 25 at 23:30
SebastianoSebastiano
11.3k42164
11.3k42164
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480391%2ftyping-co-2-easily%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried newcommandcotwomathrmCO_2 see tex.stackexchange.com/questions/44545/… also tex.stackexchange.com/questions/393855/…
– KJO
Mar 20 at 2:48
7
For anyone new to latex reading this question: There are two separate issues here. One is that mathrm can only be used in math mode. The second one is that you can't (usually) have digits in macro names.
– sgf
Mar 20 at 15:35
Oh I did not realize you couldn't have digits in macro names! Cool, thanks!
– Hayley
Mar 21 at 0:36