-
Notifications
You must be signed in to change notification settings - Fork 0
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird error related to \section and the number of the surrounding paragraphs #1
Comments
Seems to be a bug… Thanks for reporting. I'll look into this later. |
It seems the commit b70266e sucessfully fixed this bug. I hope this works fine with you too. |
@wtsnjp Thank you, it works. |
Oops, it doesn't. A problem still occurs if numbers of the above/below paragraphs are 0 and greater than 4, resp. \documentclass{article}
\usepackage{graphicx}
\usepackage{exwrapfig}
\begin{document}
\section{Section}
\begin{wrapfigure}{r}{0.3\textwidth}
\includegraphics[height=1ex]{example-image}
\end{wrapfigure}
lorem
ipsum
dolor
sit
amet
\end{document} gives
If I ignore them, a PDF is generated but its indentation is odd: left: wrapfig, right: exwrapfig |
I think the commit 45479b1 prevent the error. However, the output is not fully compatible with the wrapfig package (maybe I have to insert |
Yes, it works. FYI, another error occurs if \documentclass{article}
\usepackage{graphicx}
\usepackage{exwrapfig}
\begin{document}
\section{Section}
lorem
\begin{wrapfigure}{r}{0.3\textwidth}
\includegraphics[height=1ex]{example-image}
\end{wrapfigure}
ipsum
\section{Section2}
\end{document} gives
I tested several conditions by #!/usr/bin/env python3
import pathlib
import jinja2
import subprocess
from typing import Iterable, Dict
def main(texs: Iterable[str] = None, max_num_above_pars: int = 3, max_num_below_pars: int = 3,
next_structures: Dict[str, str] = None, clean_success: bool = True,
clean_ignorable: bool = False, clean_fail: bool = False):
if texs is None:
texs = [
"pdflatex",
"lualatex",
"xelatex",
]
if next_structures is None:
next_structures = {
"none": "",
"section": r"\section{Section}",
"subsection": r"\subsection{Subsection}",
"paragraph": r"\paragraph{Paragraph}",
}
cmd = jinja2.Template(r"""{{tex}} -jobname={{jobname}} << EOF
\documentclass{article}
\usepackage{graphicx}
\usepackage{exwrapfig}
\begin{document}
\section{Section 1}
{{above_pars}}
\begin{wrapfigure}{r}{0.1\textwidth}
\includegraphics[height=1ex]{example-image}
\end{wrapfigure}
{{below_pars}}
{{next_structure}}
\end{document}
EOF""")
lorem_ipsum = """Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum."""
possible_errors = {
"capacity": "TeX capacity exceeded",
"lastbox": "lastbox",
"svsechd": "@svsechd",
}
lines = {
"short": lorem_ipsum[:5],
"long": lorem_ipsum,
}
print("engine", "length", "above", "below", "next struct", "error", "PDF generated?", sep="\t")
for tex in texs:
for length, line in sorted(lines.items(), reverse=True):
for num_above_pars in range(max_num_above_pars):
for num_below_pars in range(max_num_below_pars):
if num_above_pars == 0 and num_below_pars == 0 and length == "long":
continue
for next_structure in sorted(next_structures.items()):
cond = [tex, length, num_above_pars, num_below_pars, next_structure[0]]
jobname = "-".join(map(str, cond))
subprocess.run("rm -f {}.*".format(jobname), shell=True)
p = subprocess.run(cmd.render(tex=tex, jobname=jobname,
above_pars="\n\n".join([line] * num_above_pars),
below_pars="\n\n".join([line] * num_below_pars),
next_structure=next_structure[1]),
stdout=subprocess.DEVNULL, shell=True)
r = p.returncode
if r == 0:
if clean_success:
subprocess.run("rm -f {}.*".format(jobname), shell=True)
else:
subprocess.run("rm -f {}.aux".format(jobname), shell=True)
errors = []
for k, v in possible_errors.items():
pg = subprocess.run("grep -Fq '{}' {}.log".format(v, jobname), shell=True)
if pg.returncode == 0:
errors += [k]
if not errors:
errors = ["UNKNOWN"]
is_pdf_gen = pathlib.Path("{}.pdf".format(jobname)).exists()
if is_pdf_gen:
if clean_ignorable:
subprocess.run("rm -f {}.*".format(jobname), shell=True)
else:
if clean_fail:
subprocess.run("rm -f {}.*".format(jobname), shell=True)
print(*cond, " ".join(sorted(errors)), is_pdf_gen, sep="\t")
if __name__ == "__main__":
main(texs=["pdflatex"]) which gives (PDFLaTeX)
|
I gave up to stay in the expl3 world and replace a tl variable (i.e., a normal macro) |
This problem is hard to explain...
pdfLaTeX, LuaLaTeX, and XeLaTeX fail to compile a code like
\section
–wrapfigure
environment–multiple paragraphs.MWE is
whose error message is
The engines also fails to compile a code like
\section
–A SINGLE paragraph–wrapfigure
environment–one or more paragraphs likewith another error:
Compilation failure of
wrapfigure
inside section depends on the numbers of the paragraphs around the environment.Here is the summary:
! Extra \else
)! TeX capacity exceeded
)Compilation succeeds if
\section
is commented out (\subsection
and\subsubsection
does not affect).wrapfig
has no error in all of the cases.The text was updated successfully, but these errors were encountered: