Skip to content
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

Add support for alt text as short title in latex #2447

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Text/Pandoc/Writers/LaTeX.hs
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,14 @@ blockToLaTeX (Para [Image txt (src,'f':'i':'g':':':tit)]) = do
inNote <- gets stInNote
capt <- inlineListToLaTeX txt
img <- inlineToLaTeX (Image txt (src,tit))
short <- stringToLaTeX TextString tit
return $ if inNote
-- can't have figures in notes
then "\\begin{center}" $$ img $+$ capt $$ "\\end{center}"
else "\\begin{figure}[htbp]" $$ "\\centering" $$ img $$
("\\caption" <> braces capt) $$ "\\end{figure}"
if null short
then ("\\caption" <> braces capt) $$ "\\end{figure}"
else ("\\caption" <> brackets (text short) <> braces capt) $$ "\\end{figure}"
-- . . . indicates pause in beamer slides
blockToLaTeX (Para [Str ".",Space,Str ".",Space,Str "."]) = do
beamer <- writerBeamer `fmap` gets stOptions
Expand Down
2 changes: 1 addition & 1 deletion tests/writer.latex
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ From ``Voyage dans la Lune'' by Georges Melies (1902):
\begin{figure}[htbp]
\centering
\includegraphics{lalune.jpg}
\caption{lalune}
\caption[Voyage dans la Lune]{lalune}
\end{figure}

Here is a movie \includegraphics{movie.jpg} icon.
Expand Down