Tables or images too wide in Pandoc output as DOCX or PDF/LaTeX -


i writing quick , dirty report using pandoc , markdown.

i need generate pdf or docx minimum hassle, don't care (best both, of course). also, constrained regarding figures , tables -- have been generated priori program , rather able insert them convert them suit pandoc's needs.

however, main constraint don't want edit resulting document manually, latex or docx. want editing in markdown.

here problem:

  • in docx, tables displayed fine: have width of document. however, figures wide. can either convert images lower resolution (which doesn't nice), or manually resize images in word (which out of question).
  • in pdf, generated figures fine (more or less), 2 problems appear:
    • the tables wide, because there no line breaks, and
    • latex being latex, order of figures , tables "reorganized", is, not consecutive.

thus, none of documents generated usable purposes.

all wanted slap results , generate file can send scientist.

question: best solution generate quick , dirty report in pandoc minimum effort , @ least results visible?

update: upgrading pandoc 1.4 or later solves issue -- figures have correct sizes in docx documents.

control on image size

currently cannot control feature directly markdown. latex/pdf output, automatically handled latex/pdflatex itself.

in recent months there have been discussions going on in pandoc developer + user community how best implement , create easy-to-use syntax, example

![image caption](./path/to/image.jpg "image comment"){width="60%", height="150px"} 

(warning: example only, made on spot + extracted thin air myself -- can't remember latest state of discussion...) designed transfer all supported output formats can contain images, not latex/pdf.

so along these lines planned major new feature next major release of pandoc, , start working better in odt/docx output well.

control on table/cell widths , line breaks within cells

how specify tables in markdown syntax?

are aware pandoc supports several variations gid_tables, pipe_tables, simple_tables , multiline_tables?

you should using pandoc --from=markdown+multiline_tables ... command , write critical tables multiline_tables in markdown.

read details via man pandoc_markdown...

multiline tables give limited control on width of individual columns in output, widening or narrowing column widths in markdown source itself.

order of figures , tables when outputting latex/pdf

pandoc supports insertion of raw_tex lines , environments markdown source file. when encounters such lines, transmits them un-changed latex output. (but ignored other outputs.)

so can insert lines like

\newpage{} 

into markdown enforce page break. gives limited control on keeping order of mis-behaving figures or tables. (after all, said "quick , dirty" method, not sophisticated typeset document...)

of course, if know latex more , better, can use stuff /floatbarrier inside markdown.

going down road (mixing latex code markdown) gives few disadvantages:

  1. the markdown not pretty more.
  2. the markdown not work other output formats (should need them).

but advantage still are:

  1. you writing , modifying document text faster in markdown authoring in latex.
  2. you have additional control on final of pdf:
    • order of tables + figures
    • look + width of tables + figures (because, can of course insert complete latex 'figure' or 'table' environment).

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -