ar5iv icon indicating copy to clipboard operation
ar5iv copied to clipboard

Improve article 1611.06288

Open dginev opened this issue 3 years ago • 3 comments

Exact location of issue The figure at 6.2: https://ar5iv.labs.arxiv.org/html/1611.06288#S6.SS2

Problem details

The conversion interpreted the source figure as having 1 subfigure image per row, even on the widest displays. This may be the same (or very similar) cause for the wrong positioning in issue #163 .

In the PDF, this is a 4x4 subfigure grid, which I think we can emulate exactly on wide browser displays:

dginev avatar Aug 06 '22 12:08 dginev

This figure contains a series of {subfigure} environments, each of which has two \includegraphics and a caption. But the inner includegraphics seem to rely on an adjusted \textwidth value, so that each image ends up 1/4 of the main width.

Source:

\begin{figure}[!htp]
	\begin{center}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.491\textwidth,height=0.49\textwidth]{pfciso02} 
			\includegraphics[width=0.491\textwidth,height=0.49\textwidth]{pfc02}
			\caption*{$t=40$}
		\end{subfigure}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso10} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc10}
			\caption*{$t=200$}
		\end{subfigure}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso100} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc100}
			\caption*{$t=2000$}
		\end{subfigure}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso200} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc200}
			\caption*{$t=4000$}
		\end{subfigure}	
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso300} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc300}
			\caption*{$t=6000$}
		\end{subfigure}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso400} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc400}
			\caption*{$t=8000$}
		\end{subfigure}	
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso500} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc500}
			\caption*{$t=10000$}
		\end{subfigure}
		\begin{subfigure}{0.49\textwidth}
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfciso600} 
			\includegraphics[width=0.49\textwidth,height=0.49\textwidth]{pfc600}
			\caption*{$t=12000$}
		\end{subfigure}						
		\caption{...}
		\label{fig:long-time-pfc}
	\end{center}
\end{figure}

dginev avatar Aug 31 '23 02:08 dginev

One unique aspect to this issue is the nested reuse of \textwidth, where the inner \textwidth inside a {subfigure} has changed to the provided width argument ({0.49\textwidth} above).

I found a one line patch that remediates the issue:

--- a/lib/LaTeXML/Package/subcaption.sty.ltxml
+++ b/lib/LaTeXML/Package/subcaption.sty.ltxml
@@ -64,6 +64,7 @@ DefEnvironment('{subfigure}[]{Dimension}',
     . "</ltx:figure>",
   properties   => sub { (layout => 'vertical', width => $_[2]); },
   beforeDigest => sub { beforeFloat('subfigure', preincrement => 'figure'); },
+  afterDigestBegin => sub { AssignRegister('\textwidth' => $_[2]);},
   afterDigest  => sub { afterFloat($_[1]); });
 
 DefEnvironment('{subfigure*}[]{Dimension}',

We should discuss the details here with @brucemiller, since I am not entirely certain about the timing between modifying \textwidth and setting \hsize for beforeFloat. Either beforeFloat has to be moved to the later stage afterDigestBegin, or the setting of \hsize on its own should... Maybe?

dginev avatar Jan 25 '24 02:01 dginev

I am not entirely sure what slipped here, but the article has regressed to a Fatal outcome. Something to mark...

dginev avatar Mar 24 '24 01:03 dginev