Chemfig/Chemnum 경로

Chemfig/Chemnum 경로

나는 화학 논문을 쓰고 있는데, 거기에는 많은 반응 계획이 포함되어 있습니다.반응 계획표시되는 라벨을 어떻게 추가할 수 있나요? 나는 첫 번째 화합물 1에 라벨을 붙이고 싶고, 이것이 라텍스 라벨이 되어 텍스트 내에서 참조한 다음 필요하면 라벨을 변경할 수 있기를 원합니다.

MWE는 다음과 같습니다.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{letterpaper, margin = 1in}
\DeclareFloatingEnvironment[fileext = los, listname = {List of     Schemes}, name = Scheme]{scheme}
\begin{document}
        \begin{scheme}[h!]
            \centering
            \includegraphics[scale = 0.7]{Carbdiazosyn}
            \caption{Generation ...}
            \label{carbdiazosyn}
        \end{scheme}
\end{document}

답변1

Chemfig/Chemnum 경로

계획

아마도 를 사용하는 것이 가장 현명한 선택은 아니지만 chemfig단지 그것이 가능하다는 것을 보여줄 뿐입니다. chemnum분자 라벨링을 위해 패키지를 사용하고 싶을 것입니다 . 이는 다음과 같은 명령을 제공합니다.

\cmpd{<main label>.<sublabel>} % <main label> produces the 1, <sublabel> produces the a, b etc.
\refcmpd{<main label>.<sublabel>} % Acts like \ref in normal circumstances

코드는 다음과 같습니다.

\documentclass[]{report}
\usepackage{chemfig,chemnum}
\usepackage[version=4]{mhchem}
\usepackage{geometry}
\geometry{letterpaper, margin = 1in}
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext = los, listname = {List of     Schemes}, name = Scheme]{scheme}

\begin{document}
\begin{scheme}[ht]
    \centering
    %\schemedebug{true}
    \schemestart[0,1.3]
        \chemname{%
            \chemfig{[:120]*3(-[@{a1}]N=[@{db}]N-[@{a2}])%
                (-[:50,,,,red]\textcolor{red}{\ce{R1}})%
                (-[@{r2}:-50,,,,red]\textcolor{red}{\ce{R2}})%
            }
        }{\cmpd{scheme.1}}
        \arrow(.mid east--.mid west){->[$h\nu/\Delta$][$-$\ce{N2}]}
        \chemname{%
            \setlewis{0.8ex}{}{red}%
            \chemfig[shift={(0,0.4)}]{[:-30]\textcolor{red}{\ce{R1}}%
                -[,,,,red](\lewis{6:,})%
                -[::60,,,,red]\textcolor{red}{\ce{R2}}}%
        }{\cmpd[pre-label-code{scheme.2}}
    \schemestop
    \chemmove{%
        \draw[shorten <=2pt, shorten >=3pt]%
            (a1)..controls +(250:3mm) and +(340:3mm)..(db);
        \draw[shorten <=2pt, shorten >=2pt]%
            (a2)..controls +(320:3mm) and +(210:2mm)..(r2);
        }
    \caption[]{My scheme}\label{scheme1}
\end{scheme}
The arrows in \refcmpd{scheme.1} refer to electron movement! The compound in \refcmpd{scheme.2} is in red! Both \refcmpd{scheme.1, scheme.2} are in scheme \ref{scheme1}.
\end{document}

참고 사항: '레이블'을 삽입하기 위해 명령 chemnum내 에서 명령을 사용했습니다. \chemname또한 mhchem패키지를 사용하여 chemfig. 나머지는 단지 chemfig코드일 뿐입니다. :-).


Auto-pst-pdf/Chemnum 경로(권장됨)

패키지 에는 섹션 9, pg18에 있는 그림 chemnum의 태그를 교체하는 방법도 문서화되어 있습니다..eps선적 서류 비치. 매뉴얼에 따르면 이에 대한 작업 흐름은 다음과 같습니다(축어적으로 인용).

  1. 구성표를 생성하고 복합 라벨을 추가할 위치에 등의 임시 태그를 배치합니다 TMP1.TMP2
  2. 태그가 텍스트 문자열로 포함되어 있는지 확인하는 형식 eps이나 그림 으로 구성표를 내보냅니다 .ps
  3. eps를 포함합니다 \includegraphics. 그 직전에 \replacecmpd모든 임시 태그에 대해 한 번 사용합니다.

나는 개인적으로 이것을 시도하지 않았으므로(를 사용하지 않기 때문에 chemdraw) 문서를 참조하도록 하겠습니다. (아마도 이 방법을 적절하게 문서화하는 또 다른 답변이 필요할 것입니다). 어쨌든 문서에서 알 수 있듯이 chemdraw.

다음은 설명서의 예제 코드입니다.

 % code for figure 2
 \documentclass{standalone}
 \usepackage{graphicx,auto-pst-pdf,chemnum}
 \begin{document}
 \replacecmpd{Alc}% replaces TMP1
 \replacecmpd{EtherBr}% replaces TMP2
 \includegraphics{scheme-tmp.ps} % Contains TMP1 and TMP2 as embedded text strings
 \end{document}

답변2

하위 캡션을 맞추기 위해 너비를 조정해야했습니다.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{letterpaper, margin = 1in}
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext = los, listname = {List of     Schemes}, name = Scheme]{scheme}
\usepackage{graphicx}
\usepackage{subcaption}
\DeclareCaptionSubType{scheme}
\captionsetup[subscheme]{font+=footnotesize}
\begin{document}
        \begin{scheme}[htp]% h! is interpreted as "I am an idiot so replace this with something reasonable"
            \centering
            \sbox0{\includegraphics[scale = 0.7]{images/Carbdiazosyn}}% measure width
            \usebox0\par
            \makebox[1.1\wd0]{\parbox{0.45\wd0}{\subcaption{Compound 1}\label{compound1}}\hfill
              \parbox{0.45\wd0}{\subcaption{Compound 2}\label{compound2}}}
            \caption{Generation ...}
            \label{carbdiazosyn}
        \end{scheme}

\centering Of course, the reference will only return \ref{compound1}.
\end{document}

데모


캡션은 주어진 공간에 맞도록 설계되었으며 이 경우 한 줄에 들어가도록 하려고 합니다.~ 아니다서브캡션 패키지를 사용하세요.

다양한 형식 옵션이 가능합니다. 이 경우에는 캡션을 왼쪽에 배치하고 이미지는 중앙에 두었습니다.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{letterpaper, margin = 1in}
\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext = los, listname = {List of     Schemes}, name = Scheme]{scheme}
\usepackage{graphicx}

\newcounter{compound}
\newcommand{\compound}[1]% #1 = label
{\refstepcounter{compound}\label{#1}Compound \thecompound}

\begin{document}
        \begin{scheme}[htp]
            \centering
            \leavevmode\llap{\compound{test}:\qquad}%
            \raisebox{-0.5\height}{\includegraphics[scale = 0.7]{images/Carbdiazosyn}}% center
            \caption{Generation ...}
            \label{carbdiazosyn}
        \end{scheme}

\centering This references the compound index, \ref{test}.
\end{document}

데모2

관련 정보