从 TeX 文件更改 PDF 行距

从 TeX 文件更改 PDF 行距

我正在使用 pdfTeX 将 TeX 文件转换为 PDF。TeX 文件由 Doxygen(版本 1.9.3)创建。我想减少 PDF 输出中的行距。

经过一番研究,我的结论是在 doxygen.sty 文件中的以下几行中进行更改:

\newcommand\doxysection{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {2.3ex \@plus.2ex}%
                                   {\raggedright\normalfont\Large\bfseries}}
\newcommand\doxysubsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\raggedright\normalfont\large\bfseries}}
\newcommand\doxysubsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {1.5ex \@plus .2ex}%
                                     {\raggedright\normalfont\normalsize\bfseries}}
\newcommand\doxyparagraph{\@startsection{paragraph}{4}{\z@}%
                                    {3.25ex \@plus1ex \@minus.2ex}%
                                    {-1em}%
                                    {\raggedright\normalfont\normalsize\bfseries}}
\newcommand\doxysubparagraph{\@startsection{subparagraph}{5}{\parindent}%
                                       {3.25ex \@plus1ex \@minus .2ex}%
                                       {-1em}%
                                      {\raggedright\normalfont\normalsize\bfseries}}

我不确定这是正确的解决方案,但我不明白以下含义:

{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%

以及如何改变它们以减少 PDF 中的行距。

这是我的代码

\hypertarget{exmp_8c}{}\doxysection{exmp.\+c File Reference}
\label{exmp_8c}\index{exmp.c@{exmp.c}}
Include dependency graph for exmp.\+c\+:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=129pt]{exmp_8c__incl}
\end{center}
\end{figure}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
static void \mbox{\hyperlink{exmp_8c_a2cbb44cff0cf792a64055ce9c49a1b3f}{func1}} (int a, int b)
\begin{DoxyCompactList}\small\item\em this is a func \end{DoxyCompactList}\item 
int \mbox{\hyperlink{exmp_8c_a5be28ec997a6678f448917604b8c8b05}{func2}} (int x)
\begin{DoxyCompactList}\small\item\em this is a func \end{DoxyCompactList}\item 
long \mbox{\hyperlink{exmp_8c_a6eb654decf94da92003b86c5b8b2c2f0}{func3}} (char c)
\begin{DoxyCompactList}\small\item\em this is a func \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{exmp_8c_a2cbb44cff0cf792a64055ce9c49a1b3f}\label{exmp_8c_a2cbb44cff0cf792a64055ce9c49a1b3f}} 
\index{exmp.c@{exmp.c}!func1@{func1}}
\index{func1@{func1}!exmp.c@{exmp.c}}
\doxysubsubsection{\texorpdfstring{func1()}{func1()}}
{\footnotesize\ttfamily static void func1 (\begin{DoxyParamCaption}\item[{int}]{a,  }\item[{int}]{b }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [static]}}



this is a func 

\mbox{\Hypertarget{exmp_8c_a5be28ec997a6678f448917604b8c8b05}\label{exmp_8c_a5be28ec997a6678f448917604b8c8b05}} 
\index{exmp.c@{exmp.c}!func2@{func2}}
\index{func2@{func2}!exmp.c@{exmp.c}}
\doxysubsubsection{\texorpdfstring{func2()}{func2()}}
{\footnotesize\ttfamily int func2 (\begin{DoxyParamCaption}\item[{int}]{x }\end{DoxyParamCaption})}



this is a func 

\mbox{\Hypertarget{exmp_8c_a6eb654decf94da92003b86c5b8b2c2f0}\label{exmp_8c_a6eb654decf94da92003b86c5b8b2c2f0}} 
\index{exmp.c@{exmp.c}!func3@{func3}}
\index{func3@{func3}!exmp.c@{exmp.c}}
\doxysubsubsection{\texorpdfstring{func3()}{func3()}}
{\footnotesize\ttfamily long func3 (\begin{DoxyParamCaption}\item[{char}]{c }\end{DoxyParamCaption})}



this is a func 


\begin{DoxyParams}{Parameters}
{\em c} & ~\newline
 \\
\hline
\end{DoxyParams}

这是 PDF 输出: 在此处输入图片描述

我想删除所有空行,例如 2.8.1 和 2.8.1.1 之间的空行

答案1

当我们在源代码上运行 doxygen 时,我们会看到相关部分(我将文件命名为 aa.cpp):

\doxysubsection{Function Documentation}
\mbox{\Hypertarget{aa_8cpp_a0e828b455db64ea3b215dc1bc1cf7977}\label{aa_8cpp_a0e828b455db64ea3b215dc1bc1cf7977}}
\index{aa.cpp@{aa.cpp}!func1@{func1}}
\index{func1@{func1}!aa.cpp@{aa.cpp}}
\doxysubsubsection{\texorpdfstring{func1()}{func1()}}

看起来\mbox在这种情况下这里没有必要,因为只需删除命令\mbox我们就会得到:

在此处输入图片描述

而不是以下版本\mbox

在此处输入图片描述

由于\Hypertarget(定义为\newcommand{\Hypertarget}[1]{\Hy@raisedlink{\hypertarget{#1}{}}})和\label只是锚点/标记,因此我认为\mbox这里没有必要。

相关内容