0

I am using pdfTeX to convert TeX files to PDF. the TeX file is created by Doxygen(version 1.9.3). I want to reduce the line spacing in the PDF output.

After some research, my conclusion was to make changes in doxygen.sty file in those lines:

\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}}

I am not sure this is the right solution however I cant understand the meaning of:

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

and how to change them to reduce the line spaces in the PDF.

This is my code

\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}

This is the PDF output: enter image description here

I want to remove all those empty lines for example between 2.8.1 and 2.8.1.1

lsz
  • 3
  • Seems that there are 2 separate questions here...? First, for what the meaning is, read "rubber length" in LaTeX unofficial reference manual or "glue" in TeX book. – user202729 May 03 '22 at 07:08
  • For the other question try applying Change line spacing inside the document - TeX - LaTeX Stack Exchange first, then if it does not work post a minimal working example that shows the issue. – user202729 May 03 '22 at 07:08
  • As as side note: better not to change the doxygen.sty but to create a new .sty file with just the changed commands in it, in this case a \renewcommand command and add the new .sty file to your doxygen run by setting LATEX_EXTRA_STYLESHEET. – albert May 03 '22 at 07:56
  • the space definitions you show are not changing the line spacing of general text paragraphs but rather the spacing above and below section headings (which is not usually referred to as "line spacing"). As such, the example code shown does not really relate to the question. Can you edit the question to clarify what you want to change? Preferably show a small but complete generated document and say how you want to change the output. – David Carlisle May 03 '22 at 10:10
  • The current form of the input shown is not suitable on the tex forum as a question as users here don't all (probably an understatement) know how to go from the c code through doxygen to the LaTeX code. – albert May 03 '22 at 13:29

1 Answers1

0

When we run doxygen over the source we see in the relevant part (I named my file 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()}}

It looks like the \mbox is in this case not necessary here, as removing just the \mbox command we get:

enter image description here

instead of the version with \mbox:

enter image description here

As \Hypertarget (which is defined as \newcommand{\Hypertarget}[1]{\Hy@raisedlink{\hypertarget{#1}{}}}) and \label are just anchors / markers I don't think the \mbox is necessary here.

albert
  • 1,313
  • @DavidCarlisle Is my assumption about the use of \Hypertarget and \label correct here and can the \mbox be removed or do you know about corner cases where it is necessary in this type of construct without visible text? – albert May 03 '22 at 13:51
  • It looks like there is already a proposed pull reuest for this problem "issue #9159 Doxygen produces ugly empty space in LaTeX and PDF output because of hypertargets": https://github.com/doxygen/doxygen/pull/9163 (I didn't remember it anymore). – albert May 03 '22 at 16:14