LaTeX Chemical LaTeX Typesetting - Physicsforums Tutorial

  • Thread starter Thread starter Monique
  • Start date Start date
  • Tags Tags
    Chemical Latex
AI Thread Summary
Physics Forums has introduced a new LaTeX feature that allows users to typeset complex formulas and equations clearly and accurately. This enhancement significantly improves the clarity of scientific communication, moving away from less precise text representations. Users can now create equations with subscripts, superscripts, and various symbols, which were previously cumbersome to format. The discussion includes examples of chemical equations and mathematical formulas, demonstrating the ease of use and flexibility of LaTeX. Participants share tips on formatting, including the use of specific commands for better readability and aesthetics. There are also inquiries about advanced symbols and formatting techniques, indicating a collaborative effort to master LaTeX for chemistry and physics applications. Overall, the new feature is well-received, with users encouraged to explore and practice their typesetting skills.
  • #51
Hmmmm. I'm not quite sure what you are getting at...
 
Physics news on Phys.org
  • #52
Well, take a look at the actual TeX code for the two examples. To compare, here's the original:

Code:
      10\textrm{K}_{4}\textrm{Fe(CN)}_{6}+122\textrm{KMn  O}_{4}+299\textrm{H}_{2}\textrm{SO}_{4}\rightarrow  162\textrm{KHSO}_{4}+5\textrm{Fe}_{2}\textrm{(SO}_  {4}\textrm{)}_{3}+122\textrm{MnSO}_{4}+60\textrm{H  NO}_{3}+60\textrm{CO}_{2}+188\textrm{H}_{2}\textrm  {O}

and here's the one I propose

Code:
%this should go in your preamble somewhere
\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}

%and then later, in your document...
\chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O}

Another advantage is that, should you ever decide that you like italic letters in your formulas, or if you want them bolded or whatever, you can just go edit the \chem definition, and then all instances of that command in your document will take advantage of the global edit.
 
  • #53
OK, I'll bite. Placing "\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}" within the tex delimiters...

\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}

and entering the string you recommended "\chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O}"

yields,

\chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O}

versus just entering the string between tex delimiters...

10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O

Aside from the spacing between the '+' signs, I see no advantage.
 
Last edited:
  • #54
For the scope of this forum, try this:

Code:
(tex)%NOTE: replace ( with [ to use!
\newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}
\chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O} 
(/tex)

which should work out to look like


<br /> \newcommand{\chem}[1]{\ensuremath{\mathrm{#1}}}<br /> \chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O} <br />

When you put things in the [/ tex] delimiters here, it looks like it&#039;s an isolated environment, and thus any commands you define must be used within that same [/ tex] delimiter. My point here, although it may be a minor one in retrospect, is that I introduce an italic-free typesetting environment for stuff like chemical formulas or spectroscopic notation, which can work independent of an equation block.&lt;br /&gt; &lt;br /&gt; I had assumed this forum was discussing the general application of LaTeX for typesetting chemistry-related stuff. My earlier suggestion of placing the \newcommand{} within the preamble is referring to a LaTeX document, in my case, prepared by MikTeX 2.7.
 
  • #55
lemme try

6CO_2 + 6H_2O \xrightarrow{\mathit{Light Energy}} C_6 H_{12} O_6 + CO_2, \Delta G^{\circ} = +2870~\mathrm{kJ/mol}

\chem{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O}

awsome
 
Last edited:
  • #56
Hello,

I was wondering if someone could help me with some latex typeset. I can't find how to do the L- and D- used in chemistry to distinguish the chirality of a compound.

Thanks for your help!
 
  • #57
Thanks so much for this thread! I just have one question.

How do I get the equilibrium arrows to stay centered when listed on a page?

NO_2 + CO~ \xrightarrow{k_1}~ NO + NO_3NO_3 + CO~ \xrightarrow{k_2}~ NO_2 + CO_2 +XXXX +YYYYYY +ZZZZZZ


Can you see how if this was centered on a page the arrows wouldn't be aligned?
 
  • #58
Hi icosane,

Some time ago, I participated in a thread that talked about multi-line equations in LaTeX. You can find it at https://www.physicsforums.com/showthread.php?t=325387.

For your example, try something like:

<br /> \begin{align}\begin{split}<br /> NO_2 + CO~ &amp;\xrightarrow{k_1}~ NO + NO_3\\<br /> NO_3 + CO~ &amp;\xrightarrow{k_2}~ NO_2 + CO_2 +XXXX +YYYYYY +ZZZZZZ<br /> \end{split}\end{align}<br />

To show you that the alignment is behaving:

<br /> \begin{align}\begin{split}<br /> NO_2 + CO~ &amp;\xrightarrow{k_1}~ NO + NO_3\\<br /> NO_3 + CO + XXXX + YYYYY + ZZZZZZ~ &amp;\xrightarrow{k_2}~ NO_2 + CO_2 +XXXX +YYYYYY +ZZZZZZ<br /> \end{split}\end{align}<br />
 
  • #59
I am shocked to see there appears to be no means of illustrating ringed structures since I see none in this thread. I guess I'm just really shocked of this. How can you discuss chemistry with ringed compounds and not have a means of displaying them nicely?
 
  • #60
jackmell said:
I am shocked to see there appears to be no means of illustrating ringed structures since I see none in this thread. I guess I'm just really shocked of this. How can you discuss chemistry with ringed compounds and not have a means of displaying them nicely?

Let's face it - it is not chemical forums, it is PHYSICS forums.
 
  • #61
Borek said:
Let's face it - it is not chemical forums, it is PHYSICS forums.

Hi Borek. Ok, I have found a wonderful alternative: chemfig. Here for example is the code to draw in LaTex, a very nice caffeine molecule:

\chemfig[][scale=0.5]{[:30]O=C*6(-N(-CH_3)-C*5(-N=C-N(-CH_3)-)=C-C(=O)=N(-CH_3)-)}

So what I'll do is simply write what I want in LaTex and just post the PDF file. :)

Just learned to a few minutes ago. Not too hard. Just follow the chemfig user manual. Here it is in PDF for those interested:
 

Attachments

Last edited:

Similar threads

Replies
3
Views
2K
Replies
4
Views
4K
Replies
2
Views
6K
Replies
766
Views
737K
Replies
7
Views
3K
Replies
1
Views
4K
Replies
6
Views
4K
Back
Top