Re: PDF misery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Sat, 17 Feb 2024 14:29:24 -0700
Jonathan Corbet <corbet@xxxxxxx> escreveu:

> So, FYI, I have Vegard's PDF-generation fix applied here, but I've not
> pushed it yet (even though I think it's fine) because I wanted to be
> sure that all was well with PDF generation.

Yeah, LaTeX Sphinx output is really tricky, requiring workarounds from
time to time to address some issues.

> The first change removes the deepest level of nesting in an impressive
> set of enumerated lists; the second removes the nth-level subsection
> heading markup for "Sorting xfarrays".  Having either of those present
> will cause Latex to blow a fuse.

...

> I'm surprised that nobody else is reporting this problem.  I honestly
> don't see a fix other than changing the organization of the document to
> avoid both deeply nested itemized lists and section structure, which is
> less than entirely desirable.  I think there are good reasons for
> avoiding structures that deep, but limitations in the tooling aren't one
> of them.

The maximum indentation level seems easily fixable. See my PoC at the
end of this e-mail.

From:
	- https://tex.stackexchange.com/questions/571826/too-deeply-nested
	- https://stackoverflow.com/questions/1935952/maximum-nesting-level-of-lists-in-latex

And some local tests I did on Fedora 39, the default enum indentation
limit is 7.

This is configurable by adding \setlistdepth after using enum item,
e. g.:

	\usepackage{enumitem}
	\setlistdepth{9}

I guess we can add something like that to latex_elements at conf.py to 
increase the maximum limit.

> Incidentally, on F38, I also run into a similar Latex error in
> .../userspace-api/media/v4l/pixfmt-rgb.html, which has a set of tables
> from hell.  On F39, that somehow works.  Weird.

I remember in the past I had to increase some LaTeX memory limits,
but it seems that this is not required anymore.

> 
> The *other* problem is that PDF generation of the Chinese, Korean, or
> Japanese translations fails with:
> 
>   xdvipdfmx:fatal: Invalid TTC index number
> 
> This, I am thinking, is likely some sort of F39 bug.  xdvipdfmx is
> finding the CJK fonts just fine, but then something clearly goes wrong.
> I'll try to find the time to narrow that down and perhaps put in a
> proper bug report.
> 
> Meanwhile, I wish I knew what to do to make the PDF build a bit more
> robust.  I wish that rst2pdf or rinohtype would progress to the point
> where they could be used, and Latex could be taken out of the picture,
> but no such luck.

I haven't tested rst2pdf for a while on Kernel builds. It works fine
when producing IGT documentation, but the docs there are too trivial
to cause issues.

Didn't try rinohtype yet.

Ideally, if one of those would work, that would be a lot better, as
LaTeX makes it a lot more complex than it should be.

> Oh well...sorry for rambling at you...I wish I had a good plan for
> making this whole thing better.
> 
> jon

Regards,
Mauro

---

The way the .tex file below is, it builds fine with:

	$ xelatex  -halt-on-error /tmp/test.tex
	This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
	...
	Output written on test2.pdf (1 page).
	Transcript written on test2.log.

If you remove this line:

	\setlistdepth{9}

You'll see the error:

	$ xelatex  -halt-on-error /tmp/test_without_setlistdepth.tex
	This is XeTeX, Version 3.141592653-2.6-0.999995 (TeX Live 2023) (preloaded format=xelatex)
	...

	! LaTeX Error: Too deeply nested.

	See the LaTeX manual or LaTeX Companion for explanation.
	Type  H <return>  for immediate help.
	 ...                                              
	                                                  
	l.60                 \item
	                           item level 7
	No pages of output.
	Transcript written on test_without_setlistdepth.log.

And it indicates that it fails when level == 7.


-


\documentclass{article}

\usepackage{enumitem}
\RequirePackage{enumitem}

\setlistdepth{9}

\setlist{nolistsep,
         leftmargin = *}
%
%
\newlist{myEnumerate}{enumerate}{9}
\setlist[myEnumerate]{
    font        = {\bfseries} ,
    topsep      = 0pt }
\setlist[myEnumerate,1]{label=\arabic* ---,ref=\arabic*}
\setlist[myEnumerate,2]{label=\arabic{myEnumeratei}.\arabic*),ref=\themyEnumeratei.\arabic*}
\setlist[myEnumerate,3]{label=\roman*),ref=\themyEnumerateii.\roman*}
\setlist[myEnumerate,4]{label=\Roman*.,ref=\themyEnumerateiii.\Roman*}
\setlist[myEnumerate,5]{label=\themyEnumerateiiii.\roman*.,ref = \themyEnumerateiiii.\roman*}
\setlist[myEnumerate,6]{label=(\arabic*)}
\setlist[myEnumerate,7]{label=(\Roman*)}
\setlist[myEnumerate,8]{label=(\Alph*)}
\setlist[myEnumerate,9]{label=(\roman*)}
\newcommand{\ben}{\begin{myEnumerate}}
\newcommand{\een}{\end{myEnumerate}}
%
\newlist{myItemize}{itemize}{9}
\setlist[myItemize]{
    topsep      = 0pt }
\setlist[myItemize,1]{label=\textbullet}
\setlist[myItemize,2]{label=---}
\setlist[myItemize,3]{label=---}
\setlist[myItemize,4]{label=---}
\setlist[myItemize,5]{label=---}
\setlist[myItemize,6]{label=---}
\setlist[myItemize,7]{label=---}
\setlist[myItemize,8]{label=---}
\setlist[myItemize,9]{label=---}
\newcommand{\bit}{\begin{myItemize}}
\newcommand{\eit}{\end{myItemize}}


\begin{document}

\section{Main section}

\section{Subsection}
\ben 
  \item item level 1
  \ben
  \item item level 2
    \bit 
    \item item level 3
      \bit
	\item item level 4
	  \bit
          \item item level 5
            \bit
              \item item level 6
              \bit
                \item item level 7
                  \bit
                  \item item level 8
              \eit
            \eit
          \eit
        \eit
      \eit
    \eit
  \item item level 2
  \een
\item item level 1
\een

\end{document}




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux