How to typeset chemical formulas in roman? [duplicate]

I'm new to LaTeX and have a desire to learn as I'm completing a PhD and have been told LaTeX is a great platform for writing scientific documents.

So, I have written a short plain English piece in TeXstudio, but have a few problems:

\documentclass[a4paper,10pt]{article}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{gensymb}
\usepackage{url}
\usepackage{wrapfig}

\bibliographystyle{plainnat}

\begin{document}

\begin{figure}[h!]
\centering
\includegraphics[width=1\textwidth]{withstupid}
\end{figure}

{\LARGE Save our planet and our species, now!?} \\

The human species faces the most important crossroads in our history, we have two choices; [1] to continue down our existing path, ignoring the impact our actions are having on the environment or [2] to take immediate action and reduce our carbon dioxide emissions, in an attempt to manage the rate of global warming and save not just the very planet we depend on to survive but also to secure a future for our own species. I believe our species is currently facing an existential risk of our own making. \\

Analysis of air bubbles from ice in the poles has shown that for thousands of years, the $CO_2$ levels in the atmosphere was stable at around 280 PPM, until 1800, when the $CO_2$ concentrations begin to exponentially increase. The start of the industrial revolution circa 1900 marked an unprecedented rate of increase in measured $CO_2$ levels in the atmosphere.\\

We burn fossil fuels to generate electricity, fuel vehicles and power industry. When we burn fossil fuel or biomaterial it produces $CO_2$ among other things. Laboratory analysis allows us to trace the sources of $CO_2$ in the atmosphere and there is no doubt that the increase in $CO_2$ is a result of human activity.\\

Fast forward to 2018 and the current levels of carbon dioxide in the atmosphere are 408PPM and rising every day. These are the highest levels measured in over 800,000 possibly even the last 20 million years.\\

\begin{figure}[h!]
\centering
\includegraphics[width=0.5\textwidth]{co2variation}
\caption{$CO_2$ variation \citep{Wikipedia17122018}}
\end{figure}

$CO_2$ is a greenhouse gas and excess levels of this gas in the atmosphere are increasing the greenhouse effect, trapping more heat in the atmosphere and raising the temperature of the Earth. Increasing global temperatures will cause irreversible damage to the environment and ecosystems around the planet.\\

International recognition of this risk resulted in a landmark agreement between Parties to the United Nations Framework Convention on Climate Change (UNFCCC) in Paris on 12th December 2015. It was agreed to combat climate change by maintaining a global temperature rise below 2\degree C above pre-industrial levels and to pursue actions to further limit the global temperature rise to 1.5\degree C. To date: 195 Parties have signed the Agreement, 179 Parties ratified. The Parties include industrialized (developed) countries and developing countries alike. \\

\begin{figure}[h!]
\centering
\includegraphics[width=0.5\textwidth]{parties}
\caption{Countries signed Paris agreement \citep{ratified}}
\end{figure}

To date temperatures have increased by around 1\degree C and we have witnessed significant climate events around the planet – extreme weather events, flooding, fires, coral bleaching, drought and heat waves.
On the 8th October 2018, the Intergovernmental Panel on Climate Change (IPCC) published a Special Report on Global Warming of 1.5\degree C. This report was called for by the IPCC in December 2015. This report was compiled by the worlds leading scientists comprising 91 authors from 40 countries. This report considers evidence and arguments from over 6,000 scientific sources. \\

\begin{figure}[h!]
\centering
\includegraphics[width=1\textwidth]{riskrisingtemp}
\caption{Risk of rising temperatures \citep{indep2014}}
\end{figure}

The IPCC report states that we could see the 1.5\degree C temperature rise between 12 and 34 years if it continues to increase at the current rate.\\

The report provides several possible pathways to achieve 1.5\degree C, all of which require fossil-fuel use to half in less than 15 years and completely eliminate their use within 30 years. This means no gas, oil, diesel, or coal use in our homes, transport or industry unless the $CO_2$ is captured and stored. We will need to increase bioenergy crop production for energy and additional forestation for natural carbon dioxide absorption. A shift towards renewable energy production and large scale carbon capture and storage will be nessecary. Widespread dietary shifts towards eating less meat and reduced material consumption, would have a significant impact on reducing $CO_2$ emissions. \\

“Without the full involvement and alignment of our technical, social, and political dimensions, 1.5\degree C and even 2\degree C won’t be possible” says Glen Peters, Research Director at Norway’s Center for International Climate Research. \\

Despite the cold hard facts, Donald Trump, ‘has his doubts about climate change’ and thinks that the climate could “change back again”. Trump has also stated that he wishes to withdraw the US from the Paris agreement. \\

\begin{figure}[h!]
\centering
\includegraphics[width=0.5\textwidth]{trumptweet}
\caption{Tweet from Donald Trump \citep{Holden2018}}
\end{figure}

The science and evidence are clear…our species is entering unchartered territory in our existence on planet Earth. I feel we only have one sensible, logical and responsible path to follow at these crossroads – to take immediate action: reduce and eliminate our dependence on fossil fuels, reduce the rate of climate change, engineer a sustainable and renewable future and hopefully save the planet for the future of our species.\\
\\
\\
\\

% IPCC (2018): SR15 Global Warming of 1.5\degree C. Headline Statements from the Summary for Policymakers. Available online at https://www.ipcc.ch/site/assets/uploads/sites/2/2018/07/sr15_headline_statements.pdf, checked on 12/17/2018.\\

National Geographic (2018): Climate change impacts worse than expected, global report warns. National Geographic. Available online at https://www.nationalgeographic.com/environment/2018/10/ipcc-report-climate-change-impacts-forests-emissions/, updated on 12/13/2018, checked on 12/17/2018.\\

unfccc.int (2018): What is the Paris Agreement? Available online at https://unfccc.int/process-and-meetings/the-paris-agreement/what-is-the-paris-agreement, checked on 12/17/2018.\\

Vitousek, Peter M; Mooney, Harold A; Lubchenco, Jane; Melillo, Jerry M (1997): Human Domination of Earths Ecosystems. In Science 277.\\

Wikipedia (2018): Special Report on Global Warming of 1.5\degree C - Wikipedia. Edited by Wikipedia. Available online at https://en.wikipedia.org/w/index.php?oldid=874073532, updated on 12/16/2018, checked on 12/17/2018.\\

WWF (2018): The Effects Of Climate Change. Available online at https://www.wwf.org.uk/effectsofclimatechange, updated on 12/17/2018, checked on 12/17/2018.\\

\bibliography{references}

\end{document}


Problem

I have had to mess with the CO2 to have the subscript, but now it comes out in italics when i compile - can i have it without italics?

marked as duplicate by clemens, Phelype Oleinik, user36296, TeXnician, TroyDec 21 '18 at 15:07

• You probably want to change the title to something more related to your actual problem: writing chemical compounds, then it is easier to find it for others later on. – daleif Dec 21 '18 at 10:05
• Could you please remove the \\ from your code? They are wrong. And please shorten your example. For someone who wants to learn LaTeX you are quite unwilling to accept advises. If I see this again I will start to downvote. – Ulrike Fischer Dec 21 '18 at 11:31
• @Johannes_B I don't know of your help. If you prefer I remove my answer. – Sebastiano Dec 21 '18 at 11:54
• @sebastiano it was a comment to a different question. – Johannes_B Dec 21 '18 at 12:12

The standard today is to use mhchem (or similar packages), less typing

\documentclass{article}
\usepackage[version=4]{mhchem}
\begin{document}

\ce{CO2}

\end{document}


The the mhchem documentation for details.

Another similar package is chemformula (as suggested by @Dailef) to type­set chem­i­cal for­mu­las and re­ac­tions. The link is taken from CTAN Comprehensive TEX Archive Network.

\documentclass{article}
\usepackage{chemformula}
\usepackage{lipsum}
\begin{document}
\ch{CO_2} \lipsum[1]
\ch{CO_2}
\end{document}


You should use $\mathrm{CO}_2$, which provides exactly what you're looking for.

• Chemistry is not maths. Spacing between two characters that belong together may be wrong. Fe in math mode are two tokens ($F$ multiplied by $e$), in chemistry it denotes Ferrum. – rexkogitans Dec 21 '18 at 14:00

According to this and this answer the following code does what you're looking for:

\documentclass{article}

\begin{document}

Subscript without italics: CO\textsubscript{2}

\end{document}


Edit: The package fixltx2e mentioned in the first linked answer is no longer needed for this.

• Please don't use fixltx2e, all the fixes of this package were enabled by default in the LaTeX format in 2015, the odd lack of this "expectable" command in LaTeX kernel is now history. – AboAmmar Dec 21 '18 at 9:58
• @AboAmmar Very good point. Also just noticed that. Fixed. – chrisma Dec 21 '18 at 10:01