代码中有什么问题

代码中有什么问题
\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{shapes,shadows,arrows}
\begin{document}
\textbf{CELL CYCLE AND CELL DIVISION \hspace{5mm}-\hspace{5mm}(i)MITOSIS/MITOTIC}

\setlength{\parindent}{8.42cm}\textbf{(ii)MEIOSIS/MEIOTIC}
\\\\\\

\begin{center}
%styles
\tikzstyle{block1}   =[rectangle,draw=black,rounded corners,minimum width=2cm, minimum height=1cm,fill=green!40]
\tikzstyle{block2}   =[rectangle,draw=red,rounded corners,minimum width=1.5cm, minimum height=0.39cm,fill=yellow!40]
\tikzstyle{block3}   =[rectangle,draw=purple,rounded corners,minimum width=3.5cm, minimum height=2cm,]
\tikzstyle{arrow}    =[thick,->,>=stealth]

\begin{tikzpicture}
%entering
\node[block1](nick1){\textbf{CELL CYCLE-[MITOSIS]}};
\node[block3,above of=nick1,yshift=1cm](int){\textcolor{cyan}{\underline{MITOSIS}} - No. of Chromosones in the parent and progeny cells is same. It is called as equational division};
\node[block2,below of=nick1,xshift=-3cm](nick2){Interphase};
\node[block2,below of=nick1,xshift=3cm](nick3){M-Phase(Mitosis Phase)};
\node[block3,below of=nick2](des1)
{The Interphase is divided into $3$ phases
\begin{itemize}
\item $G_1$-Phase(Gap-$1$)
\item $S$-Phase(Synthesis)
\item $G_2$-Phase(Gap-$2$)
\end{itemize}};
%arrows
\draw[arrow](nick1) -| (nick2);
\draw[arrow](nick1) -|(nick3);
\end{tikzpicture}
\end{center}
\end{document}

答案1

我将您提供的文本编译为 MWE,添加varwidth环境后输出下一个结果。

在此处输入图片描述

以下是代码

\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{shapes,shadows,arrows.meta}
\usepackage{varwidth}
\begin{document}
\textbf{CELL CYCLE AND CELL DIVISION \hspace{5mm}-\hspace{5mm}(i)MITOSIS/MITOTIC}

\setlength{\parindent}{8.42cm}\textbf{(ii)MEIOSIS/MEIOTIC}
\\\\\\

\begin{center}
%styles
\tikzstyle{block1}   =[rectangle,draw=black,rounded corners,minimum width=2cm, minimum height=1cm,fill=green!40]
\tikzstyle{block2}   =[rectangle,draw=red,rounded corners,minimum width=1.5cm, minimum height=0.39cm,fill=yellow!40]
\tikzstyle{block3}   =[rectangle,draw=purple,rounded corners,minimum width=3.5cm, minimum height=3cm,]
\tikzstyle{arrow}    =[thick,->,>=stealth]

\begin{tikzpicture}
%entering
\node[block1](nick1){\textbf{CELL CYCLE-[MITOSIS]}};
\node[block3,above of=nick1,yshift=1cm](int){\textcolor{cyan}{\underline{MITOSIS}} - No. of Chromosones in the parent and progeny cells is same. It is called as equational division};
\node[block2,below of=nick1,xshift=-3cm](nick2){Interphase};
\node[block2,below of=nick1,xshift=3cm](nick3){M-Phase(Mitosis Phase)};
\node[block3,below of=nick2,yshift=-1cm](des1){\begin{varwidth}{\linewidth} The Interphase is divided into $3$ phases\par\vspace{0.1in}
\begin{itemize}
\item $G_1$-Phase(Gap-$1$)
\item $S$-Phase(Synthesis)
\item $G_2$-Phase(Gap-$2$)
\end{itemize}\end{varwidth}};
%arrows
\draw[arrow](nick1) -| (nick2);
\draw[arrow](nick1) -|(nick3);
\end{tikzpicture}
\end{center}
\end{document}

答案2

不清楚你喜欢什么。像这样吗?

在此处输入图片描述

(红线表示文本边框)

由于您的图像比文本宽度宽,我引入了geometry包来定义较小的页边距(我使用其默认设置)。此外,第一个文本插入表格中。图像略作修改,可以适合文本:

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                positioning,
                shadows, shapes}
\usepackage{array}
\usepackage{enumitem}

\begin{document}

\noindent\begin{tabular}{@{} >{\bfseries}l c >{\bfseries}l @{}}
CELL CYCLE AND CELL DIVISION
    & - & (i) MITOSIS/MITOTIC   \\
    &   & (ii) MEIOSIS/MEIOTIC
\end{tabular}

\begin{center}
    \begin{tikzpicture}[
node distance = 4mm and 3mm,
block1/.style = {rectangle, rounded corners, draw, fill=green!40, 
                 minimum width=2cm, minimum height=1cm, font=\bfseries},
block2/.style = {rectangle, rounded corners, draw=red, fill=yellow!40,
                 minimum width=1.5cm, align=center},
block3/.style = {rectangle, rounded corners, draw=purple,
                 text width=#1, align=left},
 arrow/.style = {thick,-Stealth}
                        ]
%entering
\node[block3=0.9\linewidth] (int) {\textcolor{cyan}{\underline{MITOSIS}} - No. of Chromosones in the parent and progeny cells is same. It is called as equational division};
\node[block1,below=of int]          (nick1) {CELL CYCLE-MITOSIS};
\node[block2,below  left=of nick1]  (nick2) {Interphase};
\node[block2,below right=of nick1]  (nick3) {M-Phase\\ (Mitosis Phase)};
\node[block3=0.45\linewidth,
                    below=of nick2] (des1)  {The Interphase is divided into 3 phases:
        \begin{itemize}[nosep]
    \item $G_1$-Phase (Gap-1)
    \item $S$-Phase (Synthesis)
    \item $G_2$-Phase (Gap-2)
        \end{itemize}
};
%arrows
\draw[arrow] (nick1) -| (nick2);
\draw[arrow] (nick1) -| (nick3);
    \end{tikzpicture}
\end{center}
\end{document}

相关内容