Also, I noticed a surprising aspect of .contents including optional args of environments, e.g.
>>> figs = soup.find_all('figure')
>>> fig = figs[0]
>>> fig
\begin{figure}[H]
\centering
\includegraphics[width=0.4\textwidth]{figures/vectors/vector_components.pdf}
\vspace{-2mm}
\caption{ The vector $\vec{v}=(3,2)$ is an arrow in the Cartesian plane.
The horizontal component of $\vec{v}$ is $v_x=3$
and the vertical component is $v_y=2$.}
\label{fig:vector_components}
\end{figure}
>>> fig.contents
['H',
\centering,
\includegraphics[width=0.4\textwidth]{figures/vectors/vector_components.pdf},
\vspace{-2mm},
\caption{ The vector $\vec{v}=(3,2)$ is an arrow in the Cartesian plane.
The horizontal component of $\vec{v}$ is $v_x=3$
and the vertical component is $v_y=2$.},
\label{fig:vector_components}]
I would have expected the "[H]" not to be part of the content stream since it is logically part of the environment opening tag, but as you can above the first item in contents is an H of type TexSoup.utils.Token.
Note figure-environment has correctly parsed the [H] optional arg:
>>> fig.args
[BracketGroup('H')]
so wondering why if it should be removed from the .contents stream. Let me know if this is as intended, or if I should file a bug.
Coverage remained the same at 100.0% when pulling e627903065b5ed73902829c4ea03c255ab5956c6 on minireference:docs_typo_fix into e9e89cfe21a6221f9966bee9a7c77548bf4b689e on alvinwan:master.
Coverage remained the same at 100.0% when pulling e627903065b5ed73902829c4ea03c255ab5956c6 on minireference:docs_typo_fix into e9e89cfe21a6221f9966bee9a7c77548bf4b689e on alvinwan:master.
I noticed these two small typos in the docs.
Also, I noticed a surprising aspect of
.contents
including optional args of environments, e.g.I would have expected the "[H]" not to be part of the content stream since it is logically part of the environment opening tag, but as you can above the first item in contents is an
H
of type TexSoup.utils.Token.Note figure-environment has correctly parsed the
[H]
optional arg:so wondering why if it should be removed from the
.contents
stream. Let me know if this is as intended, or if I should file a bug.