2

I try to make a graph with various molecules and their modifications. The differences I want to highlight in red as seen in the picture. Pseudouridine has not only an additional NH but also the double bond shifts. So I would like to just color the inner bond of the double bond. I found this similar question but it does not really my problem.

Has anyone an idea how I can just color one line of a double bond in chemfig?

MWE:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{chemfig}

\usepackage{lipsum}
\usepackage{amsmath}
\begin{document}    
    
    \begin{figure*}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Molecules

    \definesubmol{PU}{*6(=N(-R)-(=O)-NH-(=O)-{\color{red}H}|{\color{red}N}-[,,2])}
    \definesubmol{Ubase}{*6(-N(-R)-(=O)-NH-(=O)-=)}
        
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    
        \begin{subfigure}{.2\textwidth}
            \chemfig[atom style={scale=0.6}]{!{PU}}
            \caption{Pseudouridine ($\Psi$)}\label{fig:Label1}
        \end{subfigure}
        \hspace*{\fill}
        \begin{subfigure}{.2\textwidth}
            \chemfig[atom style={scale=0.6}]{!{Ubase}}
            \caption{Uridine}\label{fig:Label2}
        \end{subfigure}
        \hspace*{\fill}
        \begin{subfigure}{.2\textwidth}
            
            \caption{}\label{fig:Label3}
        \end{subfigure}
        
        \caption{\lipsum[1]}
        
    \end{figure*}
    
    \end{document}

enter image description here

2
  • 1
    Why does the linked question not solve your problem? It seems to exactly do that
    – cgnieder
    Feb 12, 2021 at 17:42
  • @ cgnieder Whenever I tried to adapt it I got either an error or not the results what I wanted. I do not know where my mistake was but Polyn seemed to solve it. Thanks.
    – Roland
    Feb 12, 2021 at 23:03

1 Answer 1

4

I agree with cgnieder.

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{chemfig}

\usepackage{lipsum}
\usepackage{amsmath}

\catcode`_=11
\tikzset{clrdbl/.code 2 args={
    \tikzset{color=#1}\global\CF_addtomacro\CF_currentbondstyle{,color=#2}
}}
\catcode`_=8

\begin{document}    
    
    \begin{figure*}
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Molecules
        
        \definesubmol{PU}{*6(=[,,,,clrdbl={black}{red}]N(-R)-(=O)-NH-(=O)-{\color{red}H}|{\color{red}N}-[,,2])}
        \definesubmol{Ubase}{*6(-N(-R)-(=O)-NH-(=O)-=)}
        
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
        
        \begin{subfigure}{.2\textwidth}
            \chemfig[atom style={scale=0.6}]{!{PU}}
            \caption{Pseudouridine ($\Psi$)}\label{fig:Label1}
        \end{subfigure}
        \hspace*{\fill}
        \begin{subfigure}{.2\textwidth}
            \chemfig[atom style={scale=0.6}]{!{Ubase}}
            \caption{Uridine}\label{fig:Label2}
        \end{subfigure}
        \hspace*{\fill}
        \begin{subfigure}{.2\textwidth}
            
            \caption{}\label{fig:Label3}
        \end{subfigure}
        
        \caption{\lipsum[1]}
        
    \end{figure*}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .