如何旋轉箭頭、在上面書寫文字然後正確定位文字?

如何旋轉箭頭、在上面書寫文字然後正確定位文字?

我知道這有點本地化,但請耐心等待,因為我需要知道如何做到這一點。這是我必須做的事情的圖片:在此輸入影像描述

正如你所看到的,我必須畫出這些線。我知道如何在上面添加文本以及如何旋轉它們(\turn),但如何正確定位第二行文字?

更新:我還需要像這樣的雙箭頭: 在此輸入影像描述

答案1

由於您似乎在等待tikz-cd- 解決方案(感謝伯納德輸入繪圖中的所有公式):

% arara: pdflatex

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{mhchem}

\begin{document}    
    \begin{tikzcd}[row sep=0.6cm]
        \ce{Cr} \arrow{r}{1} & \ce{Cr2O3} \arrow{r} \arrow{dr}[swap]{5} & \ce{CrCl3} \arrow{r}{3} & \ce{Cr(OH)3} \arrow{dl} \arrow{r}{4} \arrow{d}{7} & \ce{Cr2O3}\\
        & &\ce{KCrO2} \arrow{r}{6} & \ce{Cr(NO3)3} &
    \end{tikzcd}    
\end{document}

在此輸入影像描述

如果你想將數字 5 旋轉到與箭頭相同的角度,你可以寫\arrow{dr}[swap,sloped]{5}


編輯

對於你的第二張照片:

\documentclass{article}
\usepackage{tikz-cd}
\usepackage{mhchem}

\begin{document} 
    \[   
    \begin{tikzcd}
        \ce{Al2(SO4)3} \arrow[shift left]{r}{2} & \ce{Al(OH)3} \arrow[shift left]{l}{7} 
    \end{tikzcd} 
    \]   
\end{document}

在此輸入影像描述

答案2

有了mhchempst-node包,這很容易。請注意,該pdf選項可讓您pdflatex使用-shell-escape (for TeX Live or MacTeX) or--enable-write18`(對於 MiKTeX)開關進行編譯。

\documentclass[pdf]{report}
\usepackage{pst-node}
\usepackage{mhchem}

\begin{document}

\[ \psset{arrows = ->, nodesep = 3pt, labelsep = 3pt, colsep = 1.2cm, rowsep = 1.2cm, npos = 0.45, arrowinset=0.2}
\begin{psmatrix}
 \ce{Cr} & \ce{Cr2O3} & \ce{CrCl3} &\ce{Cr(OH)3} & \ce{Cr2O3}\\
 & &\ce{KCrO2} & \ce{Cr(NO3)3}\\[0.5cm]
\ce{Al2(SO4)3} & \ce{Al(OH)3}
 \ncline{1,1}{1,2}\naput{1} \ncline{1,2}{1,3} \ncline{1,3}{1,4}\naput{3}\ncline{1,4}{1,5}\naput{4}
 \ncline{1,2}{2,3}\naput[npos=0.5]{5}\ncline{1,4}{2,3}\ncline{1,4}{2,4}\naput{7}
 \ncline{2,3}{2,4}\naput{6}
%
\psset{tpos = 0.52}
\ncline[offset=0.667ex]{3,1}{3,2}\taput{2}\ncline[offset=0.667ex]{3,2}{3,1}\tbput{7}
\end{psmatrix} \]

\end{document} 

在此輸入影像描述

相關內容