Align image caption with image in asciidoc - asciidoc

I have a block image inserted as shown below:
[[myimage]]
image::fig1.png[align="center", title="My caption"]
Unfortunately, the image is centered but the caption is left-aligned. I also tried doing this:
[[myimage]]
.My caption
image::fig1.png[align="center"]
but the result does not change. How can I get the image caption to also be center-aligned?
I am generating HTML output with this command (using xhtml11 as backend makes no difference):
asciidoc -v -a asciimath -d article -b html5 -o file.html file.txt

Change the CSS style sheet to do the alignment for you.

Create directory themes in your working directory then download this file into themes
Modify the captions align from left to center as below:
caption:
align: center
Specify theme file when generating pdf
asciidoctor-pdf ${adoc_file} -o ${output_pdf} -a pdf-stylesdir=themes
-a pdf-style=custom-theme.yml

Related

Convert from slidy to powerpoint with pandoc or something else?

I'd like to convert a slidy presentation to powerpoint. I tried using pandoc:
pandoc -f html+tex_math_dollars+tex_math_single_backslash test.html -o test.pptx
Does create a powerpoint file, but the file doesn't have separate slides, all the text is one slide, probably because the above command doesn't tell pandoc to recognize that the html is slidy.
I found commands for pandoc to convert TO slidy but nothing about converting FROM slidy.

How to ensure that image files from Sphinx Documentation are copied "Automatically" in LaTeX pdf

In my Sphinx documentation project, I am using images like this:
.. image:: /_static/carousel_filling.png
:width: 300px
:height: 450px
:scale: 100 %
:alt: Image here
:align: right
In the Sphinx HTML docs generated, the images are perfectly displayed in the html pages. However, when I generate pdf documents using make latexpdf, I am coming up with the following error:
'LaTeX Warning: File `{carousel_filling}.png' not found on input line ...'
I tried to find documentation related to outputting images however I came up only with this:
Excertps from:
latex_additional_files A list of file names, relative to the
configuration directory, to copy to the build directory when building
LaTeX output. This is useful to copy files that Sphinx doesn’t copy
automatically, e.g. if they are referenced in custom LaTeX added in
latex_elements. Image files that are referenced in source files (e.g.
via .. image::) are copied automatically.
So as per this, the image files should get automatically added to the output pdf file. But this is not happening. In the pdf file where the image should be there only a blank rectangle can be seen.
Interestingly, I can see that the image file has been copied to the folder _build/latex, so it means that pdflatex is able to access the image file!!
Question
How do I correctly output the images included in my Sphinx documentation in generated pdf file?
Edit 1:
In the terminal I can see the following warning:
LaTeX Warning: File `{carousel_filling}.png' not found on input line 931.
! Package pdftex.def Error: File `"""{carousel_filling}".png' not found: using dra
ft setting.
See the pdftex.def package documentation for explanation.
Type H <return> for immediate help.
...
l.931 ...t=450\sphinxpxdimen]{{carousel_filling}.png}
?
[21]
Edit 2:
In place of the image (where the rectangle outline has been output in pdf file) I can see this:
"""{carousel_filling}".png
Don't place your images under _static. It is a special-purpose folder, not for images. E.g. create img/ at the level of your rst files, move image there, and .. image:: img/my-image.png.

Left-align text when converting from md to pdf

I'm converting a markdown file to pdf with:
pandoc -o out.pdf in.md
The results are justified alignment, a pet hate. Is there any way to render regular text as left-aligned instead? Nothing appears in help for 'left' or 'align'..
You could use the latex package ragged2e.
For one document
Add this to your yaml front matter:
---
header-includes:
- \usepackage[document]{ragged2e}
---
For all documents
Edit your pandoc latex template; to create it:
pandoc -D latex > ~/.pandoc/templates/default.latex
Then open the file and add somewhere before the \begin{document}:
\usepackage[document]{ragged2e}

How to extract links behind a text tag of web page (using either curl,wget or userscript)

I'm trying to extract href links under tag.
Refer to the attachment. I want to save all link under the tag "PDF".
http://tinypic.com/r/2n9erdj/8 Sorry I'm not allowed update pictures as yet.
Specifically the href details appear as arnumber=60940cc as shown in red circle.
Can someone suggest how to implement this. I'm intending to use either a userscript or bash commands.
html elements details relavant to a single pdf is shown below.
<a aria-label="Download or View the PDF: IEEE Transactions on Power Electronics publication information" href="/stampPDF/getPDF.jsp?tp=&arnumber=6094072"><img class="button" src="http://staticieeexplore.ieee.org/assets/img/iconPdf.png" alt="PDF file icon" title="Download or View the PDF">PDF</a>
The web page I'm testing is
http://ieeexplore.ieee.org/xpl/tocresult.jsp?isnumber=6088512
The objective is to filter the content named as "pdf" and its urls.
Try this: Tweak sed part if you don't want "http://ieeexplorer.ieee.org/" just before stamp word or etc
wget http://ieeexplore.ieee.org/xpl/tocresult.jsp?isnumber=6088512 -O file.html
grep -o "href.*stamp.*\"><" file.html |sed 's#"#"http://ieeexplorer.ieee.org#;s#><##'
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094070"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094072"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094110"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6088513"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5680978"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5985544"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5723758"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5716681"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5936741"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5934597"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5734858"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5756244"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5759746"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5958614"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5999721"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6021380"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5961632"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5951783"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5983448"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5934423"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5957306"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5898425"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5959991"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5776690"
href="http://ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5953525"
OR
$ grep -o "href.*stamp.*\"><" file.html |sed 's#href="#ieeexplorer.ieee.org#;s#"><##'
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094070
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094072
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6094110
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6088513
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5680978
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5985544
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5723758
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5716681
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5936741
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5934597
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5734858
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5756244
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5759746
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5958614
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5999721
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=6021380
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5961632
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5951783
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5983448
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5934423
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5957306
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5898425
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5959991
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5776690
ieeexplorer.ieee.org/stamp/stamp.jsp?tp=&arnumber=5953525

Bash - Export odp / ppt slides as images

Is it possible to export odp / ppt slides as images using unoconv?
For example,
unoconv -f png presentation.ppt
But this unoconv command converts only the first slide as a png file. Is it possible to export all slides as individual images, say, 001.png, 002.png, 003.png using unoconv on the command line?
If not, could you suggest a simple bash script to go over slide by slide in the odp / ppt file to convert to images?
Thanks.
One way to do this is to first convert it to PDF, and then use Ghostscript to convert to PNG files. The following works for me:
unoconv -f pdf presentation.ppt
gs -sOutputFile=presentation-%03d.png -dNOPAUSE -dSAFER -sDEVICE=png16m \
-dBATCH -q -r300 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 presentation.pdf
(The -r300 parameter says to create 300 pixels-per-inch PNG files - you may want to adjust that.)
You can covert the PPT file to HTML:
unoconv -o image/ -f html SinoProbe_02_02_001.ppt
Then the image folder will fill with HTML and JPG files.
I just tested the Export as Images extension for Open Office v4.1.1 on Windows 7. Worked GREAT. I had more control over the graphics size etc than when exporting to HTML and using the included files.
http://extensions.services.openoffice.org/en/project/export-images

Resources