diff --git a/contrib/pdf_slideshow.lua b/contrib/pdf_slideshow.lua index bfcdedc..0b68417 100644 --- a/contrib/pdf_slideshow.lua +++ b/contrib/pdf_slideshow.lua @@ -123,6 +123,13 @@ local function my_write(latexfile,arg) end end +local function img_filename(file,i) + local dir=string.gsub(file, "(.*)(%/.*%..*)", "%1") + local ext=string.gsub(file, "(.*)(%..*)", "%2") + local lfile = dir.."/slide"..i..ext + return lfile +end + local function slide(latexfile,i,image,file) local title = "" if title_widget.text ~= "" then @@ -146,19 +153,15 @@ local function slide(latexfile,i,image,file) title = string.gsub(title, "\r", "") title = string.gsub(title, "\t", "") - local lfile = "slide"..i..".jpg" + local lfile = img_filename(file,i) os.rename(file, lfile) - -- fact is that latex will get confused if the filename has multiple dots. - -- so \includegraphics{file.01.jpg} wont work. We need to output the filename - -- and extention separated, e.g: \includegraphics{{file.01}.jpg} - local filenoext=string.gsub(lfile, "(.*)(%..*)", "%1") - local ext=string.gsub(lfile, "(.*)(%..*)", "%2") - my_write(latexfile,"\\begin{minipage}[b]{0,99\\textwidth}\n") - - my_write(latexfile,"\\includegraphics[height=0.95\\textheight]{{"..filenoext.."}"..ext.."}\\newline\n") - my_write(latexfile,"\\centering{{\\color{white}\\verb|"..title.."|}}\n") - my_write(latexfile,"\\end{minipage}\\quad\n") + my_write(latexfile,"\\begin{figure}\n") + my_write(latexfile,"\\begin{measuredfigure}\n") + my_write(latexfile,"\\includegraphics[height=0.92\\textheight]{"..lfile.."}\n") + my_write(latexfile,"\\end{measuredfigure}\n") + my_write(latexfile,"\\caption{{\\color{white}"..title.."}}\n") + my_write(latexfile,"\\end{figure}\n") end dt.register_storage("pdf_slideshow",_("pdf slideshow"), @@ -166,10 +169,11 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"), function(storage,image_table) local preamble = [[ - \documentclass[a4paper,10pt,landscape]{beamer} + \documentclass[a4paper,12pt,landscape]{beamer} \usetheme{default} \usepackage[utf8]{inputenc} \usepackage{graphicx} + \usepackage{threeparttable} \usepackage[space]{grffile} % needed to support filename with spaces \pagestyle{empty} \parindent0pt @@ -177,7 +181,7 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"), \usepackage{color} \pagecolor{black!100} \color{white} - \geometry{a4paper,landscape,left=5mm,right=5mm, top=5mm, bottom=5mm} + \geometry{a4paper,landscape,left=2mm,right=2mm, top=2mm, bottom=2mm} \mode \transduration{]]..delay_widget.value..[[} \setbeamertemplate{footline}{} @@ -187,6 +191,7 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"), \setbeamercolor{background canvas}{fg=white,bg=black!100} \setbeamercolor{normal text}{fg=white} \hypersetup{pdfstartpage=1,pdfpagemode=FullScreen} + \setbeamertemplate{caption}{\insertcaption} \begin{document} ]] @@ -229,7 +234,7 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"), -- finally do some clean-up local i = 1 for img,file in pairs(image_table) do - local lfile = "slide"..i..".jpg" + local lfile = img_filename(file,i) os.remove(lfile) i = i+1 end