Latex绘制甘特图

一、甘特图源代码

\begin{figure}[thp!]
\centering
\begin{ganttchart}[%Specs
    x unit=0.55cm,
    y unit title=0.6cm,
    y unit chart=0.6cm,
    % vgrid,hgrid,
    hgrid={
    *3{black!1, line width=.0pt},*1{draw=black!60, line width=.55pt}, 
    *2{black!1, line width=.0pt},*1{draw=black!60, line width=.55pt},
    *2{black!1, line width=.0pt},*1{draw=black!60, line width=.55pt},
    *3{black!1, line width=.0pt},*1{draw=black!60, line width=.55pt},
    },
    vgrid={*3{black!1, line width=.0pt},*1{draw=black!60, dash pattern=on 3.5pt off 4.5pt, line width=.35pt}},
%    title/.style={fill=teal, draw=none},
%    title label font=\heiti\color{white}\bfseries,
    title height=1,
    title label font=\sffamily\footnotesize,
    bar/.style={fill=light_blue},
    % bar/.append style={fill=light_green},
    % bar incomplete/.append style={fill=origin_orange},
    bar label font=\sffamily\footnotesize,
    bar right shift=0,
    bar left shift=0,
    bar height=0.35,
    bar top shift=0.2,
%    progress label text={},
    % bar progress label font=\small\heiti\footnotesize,
    % group progress label font=\small\heiti\footnotesize,
    % group progress label font=\small\heiti\calibri\footnotesize,
    % group progress label node/.append style={below=3pt}
    group label font=\small\sffamily\bfseries,
    group right shift=0,
    group left shift=0,
    group top shift=0.2,
    group height=.5,
    group peaks width={0.3},
    group peaks tip position=0,
    group peaks height=.25,
    ]{1}{16}
    %labels
    \gantttitle[title/.style={fill=cyan, draw=none}]{项目年度研究计划}{16}\\
    \gantttitle[title/.style={fill=light_green, draw=none}]{2024年度}{4}                 % title 1
    \gantttitle[title/.style={fill=light_red, draw=none}]{2025年度}{4} 
    \gantttitle[title/.style={fill=light_purple, draw=none}]{2026年度}{4} 
    \gantttitle[title/.style={fill=light_yellow, draw=none}]{2027年度}{4} \\              
    % Setting group if any
    \ganttgroup[group/.append style={fill=deep_green}, 
    group incomplete/.append style={fill=origin_orange},
    progress=7.5]{计划A}{1}{4}\\ 
    \ganttbar[bar/.style={fill=deep_green}, bar incomplete/.append style={fill=light_blue}, progress=30]{计划A - 1}{1}{1}\\
    \ganttbar{计划A - 2}{2}{4}\\

    \ganttgroup{计划B}{5}{8} \\ 
    \ganttbar{计划B - 1}{5}{6} \\
    \ganttbar{计划B - 2}{7}{8} \\    
    
    \ganttgroup{计划C}{9}{12} \\ 
    \ganttbar{计划C - 1}{9}{10} \\
    \ganttbar{计划C - 2}{10}{12} \\    

    \ganttgroup{计划D}{13}{16} \\ 
    \ganttbar{计划D - 1}{13}{13} \\ 
    \ganttbar{计划D - 2}{14}{14} \\ 
    \ganttbar{计划D - 3}{14}{16}
\end{ganttchart}
\caption{甘特图}
\label{fig:gant}
\end{figure}

二、Latexdiff使用

1、下载安装:https://blog.csdn.net/in546/article/details/118761750
2、添加文字用蓝字显示,删除文字不显示
latexdiff -t CFONT --no-del jsen0429.tex jsen.tex > r0415-4.tex

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
传统的 LaTeX 流程图通常使用 TikZ 宏包来绘制。下面是一个简单的示例,展示了如何使用 LaTeX 绘制一个传统的流程图: 1. 首先,在 LaTeX 文档的导言区添加以下代码,以引入 TikZ 宏包: \usepackage{tikz} 2. 在文档中的适当位置,使用以下代码创建一个 TikZ 图形环境: \begin{tikzpicture} % 在这里添加流程图的绘制代码 \end{tikzpicture} 3. 在图形环境中,可以使用一系列的命令和选项来绘制流程图。例如,可以使用以下命令创建一个矩形框表示某个步骤: \node [rectangle, draw] (step1) {Step 1}; 其中,"rectangle" 表示矩形形状,"draw" 表示绘制边框,"step1" 是该节点的名称,"Step 1" 是节点内显示的文本。 4. 可以使用箭头连接不同的步骤。例如,可以使用以下命令创建一个箭头连接两个步骤: \draw [->] (step1) -- (step2); 其中,"->" 表示箭头的方向,"(step1)" 和 "(step2)" 是要连接的两个节点的名称。 5. 可以根据需要添加更多的步骤和连接,以构建完整的流程图。 下面是一个完整的示例代码,展示了一个简单的流程图: \documentclass{article} \usepackage{tikz} \begin{document} \begin{tikzpicture} \node [rectangle, draw] (step1) {Step 1}; \node [rectangle, draw, below of=step1] (step2) {Step 2}; \node [rectangle, draw, below of=step2] (step3) {Step 3}; \draw [->] (step1) -- (step3); \end{tikzpicture} \end{document} 这个示例中,流程图包含三个步骤,每个步骤都是一个矩形框,通过箭头连接起来。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

it00zyq

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值