Skip to content

Commit

Permalink
Fix PR: pandocbounded should be used when...
Browse files Browse the repository at this point in the history
no width or height is given, not the reverse.
  • Loading branch information
jgm committed Apr 18, 2024
1 parent afc552b commit 108a2c0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Text/Pandoc/Writers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,8 @@ inlineToLaTeX (Image attr@(_,_,kvs) _ (source, _)) = do
return $
(if inHeading then "\\protect" else "") <>
(case dimension Width attr `mplus` dimension Height attr of
Nothing -> id
Just _ -> ("\\pandocbounded" <>) . braces)
Just _ -> id
Nothing -> ("\\pandocbounded" <>) . braces)
((if isSVG then "\\includesvg" else "\\includegraphics") <>
options <> braces (literal source''))
inlineToLaTeX (Note contents) = do
Expand Down
2 changes: 1 addition & 1 deletion test/Tests/Writers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ tests = [ testGroup "code blocks"
"\\begin{description}\n\\item[foo] ~ \n\\subsection{bar}\n\nbaz\n\\end{description}"
, "containing image" =:
header 1 (image "imgs/foo.jpg" "" (text "Alt text")) =?>
"\\section{\\texorpdfstring{\\protect\\includegraphics{imgs/foo.jpg}}{Alt text}}"
"\\section{\\texorpdfstring{\\protect\\pandocbounded{\\includegraphics{imgs/foo.jpg}}}{Alt text}}"
]
, testGroup "inline code"
[ "struck out and highlighted" =:
Expand Down
2 changes: 1 addition & 1 deletion test/command/3450.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
% pandoc -fmarkdown-implicit_figures -t latex
![image](lalune.jpg){height=2em}
^D
\pandocbounded{\includegraphics[width=\textwidth,height=2em]{lalune.jpg}}
\includegraphics[width=\textwidth,height=2em]{lalune.jpg}
```
2 changes: 1 addition & 1 deletion test/command/5476.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
^D
\begin{figure}
\centering
\includegraphics{test/lalune.jpg}
\pandocbounded{\includegraphics{test/lalune.jpg}}
\caption[moon]{moon\footnotemark{}}
\end{figure}
\footnotetext{the moon}
Expand Down
2 changes: 1 addition & 1 deletion test/command/7181.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
^D
\begin{figure}
\centering
\includegraphics[page=13,trim=1cm,clip,width=4cm]{slides.pdf}
\pandocbounded{\includegraphics[page=13,trim=1cm,clip,width=4cm]{slides.pdf}}
\caption{Global frog population.}
\end{figure}
Expand Down
2 changes: 1 addition & 1 deletion test/command/9045.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
^D
\begin{figure}
\centering
\includegraphics{there.jpg}
\pandocbounded{\includegraphics{there.jpg}}
\caption{hi}\label{foo}
\end{figure}
```
4 changes: 2 additions & 2 deletions test/writer.latex
Original file line number Diff line number Diff line change
Expand Up @@ -927,11 +927,11 @@ From ``Voyage dans la Lune'' by Georges Melies (1902):

\begin{figure}
\centering
\includegraphics{lalune.jpg}
\pandocbounded{\includegraphics{lalune.jpg}}
\caption{lalune}
\end{figure}

Here is a movie \includegraphics{movie.jpg} icon.
Here is a movie \pandocbounded{\includegraphics{movie.jpg}} icon.

\begin{center}\rule{0.5\linewidth}{0.5pt}\end{center}

Expand Down

0 comments on commit 108a2c0

Please sign in to comment.