Latex 如何帮助我在报告中格式化和呈现大量数据?

Latex 如何帮助我在报告中格式化和呈现大量数据?

在工作中,我负责创建信息安全报告,其中包含长篇叙述并引用我们所说的“漏洞”。这些漏洞以表格形式呈现。我使用 Microsoft Word 已有很长时间,但我刚刚偶然发现了 Latex,它似乎真的可以帮助我节省时间并提高准确性。

我一直在阅读,但网上有很多资料。当我发现这个 stackexchange 网站时,我忍不住向他们寻求一些建议。

我编写的报告平均有 100 页左右。它们有多个部分概括了整个测试的总体情况(执行概述),还有许多其他部分详细描述了攻击情况。

我对标记乳胶文档的典型语法有很好的把握,但我开始疑惑的是,如何在段落中创建交叉引用(我不确定这是否是正确的术语),该引用将链接到详细介绍特定漏洞的表格。下面是我在 Word 中执行操作的一个简短示例。

该图显示了与表格中的特定“漏洞”链接(蓝色)的段落。

链接到表格的叙述

表格如下:

在此处输入图片描述

第一张图片中的蓝色括号文本链接到显示该特定问题的表格。在 Word 中创建链接非常耗时,将数据放入表格中就更麻烦了。

我的问题是,我是否可以使用“宏”或其他一些乳胶机制轻松地在表中创建漏洞,以便在我的长篇叙述中快速引用?也许需要一些参数,例如:

{This is the title for the vulnerability, This explains the issues in question..., 8, INT, CONF, NO, NO, 6 H}

有没有办法计算表中的实际值?比如将一个值与另一个值相乘?

最后,有没有办法根据表格中的信息创建图表?

答案1

使用datatool用于繁重的工作,以及其他用于格式化的软件包:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{booktabs}
\usepackage{datatool}
\usepackage{longtable}
\usepackage{lipsum}
\usepackage{hyperref}
\begin{filecontents}{\jobname.txt}
This is the title for vuln 1, This explains the issues in question..., 8, INT, CONF, NO, NO, 6, H
This is the title for vuln 2, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 3, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 4, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 5, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 6, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 7, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 8, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 9, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 10, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 11, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 12, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 13, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 14, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 15, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 16, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 17, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 18, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 19, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 20, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 21, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 22, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 23, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 24, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 25, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 26, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 27, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 28, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 29, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
This is the title for vuln 30, This explains the issues in question..., 7, INT, CONF, NO, NO, 8, H
\end{filecontents}

\DTLloaddb[noheader,keys={title,description,cvss,access,classification,asl,np,severity,ranking}]{vulns}{\jobname.txt}
\DTLmeanforcolumn{vulns}{cvss}{\cvssavg} \DTLmeanforcolumn{vulns}{severity}{\sevavg}
\DTLround{\cvssavg}{\cvssavg}{2}
\DTLround{\sevavg}{\sevavg}{2}

\begin{document}
\lipsum[1]

What's going on at \hyperlink{vuln1}{VULN1} and \hyperlink{vuln30}{VULN30}?

\begin{longtable}{p{1.2in}p{1.2in}ccccccc}
 \toprule \bfseries{Title} & \bfseries{Description} & \bfseries{CVSS} & \bfseries{Access} & \bfseries{Class.} & \bfseries{ASL} & \bfseries{NP} & \bfseries{Sev.} & \bfseries{Rating} \\ \midrule
\DTLforeach{vulns}{%
\vtitle=title,\description=description,\cvss=cvss,\access=access,\classification=classification,\asl=asl,\np=np,\severity=severity,\ranking=ranking}{%
\hypertarget{vuln\DTLcurrentindex}{\vtitle} & \description & \cvss & \access & \classification & \asl & \np & \severity & \ranking \\} 
\bfseries{Averages} & & \cvssavg & & & & & \sevavg \\ \bottomrule
\end{longtable}

\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容