Typing CO_2 easily Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manaranewcommand 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?
How do I reattach a shelf to the wall when it ripped out of the wall?
Character Optimization: Shillelagh Whirlwind
As an international instructor, should I openly talk about my accent?
Double-nominative constructions and “von”
How to not starve gigantic beasts
Has a Nobel Peace laureate ever been accused of war crimes?
Will I lose my paid in full property
What *exactly* is electrical current, voltage, and resistance?
All ASCII characters with a given bit count
Tikz positioning above circle exact alignment
I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?
tikz-feynman: edge labels
First instead of 1 when referencing
What's the difference between using dependency injection with a container and using a service locator?
How much cash can I safely carry into the USA and avoid civil forfeiture?
My bank got bought out, am I now going to have to start filing tax returns in a different state?
A faster way to compute the largest prime factor
Do I need to watch Ant-Man and the Wasp and Captain Marvel before watching Avengers: Endgame?
Did the Roman Empire have penal colonies?
Is Diceware more secure than a long passphrase?
What is this word supposed to be?
Israeli soda type drink
How to translate "red flag" into Spanish?
Does Mathematica have an implementation of the Poisson binomial distribution?
Typing CO_2 easily
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manaranewcommand 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
About the digits:defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15
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
26.1k54791
26.1k54791
asked Mar 20 at 2:02
HayleyHayley
8815
8815
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
About the digits:defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15
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
About the digits:defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15
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
About the digits:
defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15
About the digits:
defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15
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
1
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,3651635
4,3651635
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
1
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
1
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
47.1k22672
47.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
1
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
1
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
1
1
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,07221227
1,07221227
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.5k42366
11.5k42366
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
About the digits:
defco2CO$_2$ The level of co2 in London is ....
– Fran
Apr 8 at 9:15