I want to write an asciidoc document and convert it into a pdf document. However, I want to use a format style different than the default ones. To do so I convert the txt file to docbook using asciidoc and then try to convert the resulting docbook xml to a pdf file using dblatex.
The idea is to set a particular tex style for dblatex to obtain the desired pdf result. I've copied the existing docbook.sty style as it is recommended here to do a small style modification. The only change done in the ./docbook file is \setlength{\textwidth}{18cm} to \setlength{\textwidth}{12cm}. However, when I run the command
dblatex --texstyle=./docbook.sty test.txt
Or the command
dblatex -s ./docbook.sty test.txt
Both produce the same result in the style change: none. I mean, no matter which modification I do to ./docbook.sty file, these modifications are not applied to the output. I obtain always the same result, a pdf with the default formatting. Do you guys have any idea where is the problem?
Thanks in advance.
I would recommend:
Copy the Dblatex docbook.sty to a new filename in your working directory which is "obviously yours" (e.g., mydbstyle.sty).
Continue to supply a full or relative path argument to the --texstyle option (e.g., /path/to/mydbstyle.sty or ./mydbstyle.sty). Failing to do so requires that mydbstyle.sty be in a directory enumerated by the TEXINPUTS environment variable (which you likely have not explicitly set).
Within mydbstyle.sty, use the following directives to initialize your style:
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{mydbstyle}[2013/02/15 DocBook Style]
\RequirePackageWithOptions{docbook}
% ...
% your LaTeX commands here
Pass a DocBook 4.5 XML file as an argument to Dblatex (in your example you are passing test.txt which makes me uncertain whether you're passing an AsciiDoc source file).
dblatex --texstyle=./mydbstyle.sty mybook.xml
Related
I'm trying to use the update_info command in order to add some bookmarks to an existing pdf's metadata using pdftk and powershell.
I first dump the metadata into a file as follows:
pdftk .\test.pdf dump_data > test.info
Then, I edit the test.info file by adding the bookmarks, I believe I am using the right syntax. I save the test.info file and attempt to write the metadata to a new pdf file using update_info:
pdftk test.pdf update_info test.info output out.pdf
Unfortunately, I get a warning as follows:
pdftk Warning: unexpected case 1 in LoadDataFile(); continuing
out.pdf is generated, but contains no bookmarks. Just to be sure it is not a syntax problem, I also ran it without editing the metadata file, by simply overwriting the same metadata. I still got the same warning.
Why is this warning occurring? Why are no bookmarks getting written to my resulting pdf?
using redirection in that fashion
pdftk .\test.pdf dump_data > test.info
will cause this known problem by building wrong file structure, so change to
pdftk .\test.pdf dump_data output test.info
In addition check your alterations are correctly balanced (and no unusual characters) then save the edited output file in the same encoding.
Note:- you may need to consider
Use dump_data_utf8 and update_info_utf8 in order to properly display characters in scripts other than Latin (e. g. oriental CJK)
I used pdftk --help >pdftk-help.txt to find the answer.
With credit to the previous answer, the following creates a text file of the information parameters: pdftk aaa.pdf dump_data output info.txt
Edit the info.txt file as needed.
The pdftk update_info option creates a new pdf file, leaving the original pdf untouched. Use: pdftk aaa.pdf update_info info.txt output bbb.pdf
I assume that inserting a reference to a BibTex bibliography in a YAML-metadata is sufficient for the references to be produced. This is like pandoc does not print references when .bib file is in YAML, which was perhaps misunderstood and which has no accepted answer yet.
I have the example input file:
---
title: Ontologies of what?
author: auf
date: 2010-07-29
keywords: homepage
abstract: |
What are the objects ontologists talk about.
Inconsistencies become visible if one models real objects (cats) and children playthings.
bibliography: "BibTexExample.bib"
---
An example post. With a reference to [#Frank2010a] and more.
## References
I invoke the conversion to latex with :
pandoc -f markdown -t pdf postWithReference.markdown -s --verbose -o postWR.pdf -w latex
The pdf is produced, but it contains no references and the text is rendered as With a reference to [#Frank2010a] and more. demonstrating that the reference file was not used. The title and author is inserted in the pdf, thus the YAML-metadata is read. If I add the reference file on the command line, the output is correctly produce with the reference list.
What am I doing wrong? I want to avoid specifying the bibliography file (as duplication, DRY) on the command line. Is there a general switch to demand bibliography processing and leaving the selection of the bibliography file to the document YAML-metada?
In the more recent version requires --citeproc instead of --filter=pandoc-citeproc
Theo bibliography is inserted by the pandoc-citeproc filter. It will be run automatically when biblioraphy is set via the command lines, but has to be run manually in cases such as yours. Addind --filter=pandoc-citeproc will make it work as expected.
I am using pypandoc to convert a markdown file to LaTex. My markdown file has a header, for example:
# Header Text #
When pypandoc renders the file as a .tex file, this appears as:
\hypertarget{header-text}{%
\section{Header Text}\label{header-text}}
While this is a nice feature to make it easy to link back to section headers, I don't necessarily want that and would prefer in this case for pypandoc to just generate:
\section{Header Text}
Is there a pandoc setting, or a pypandoc setting, that can be used to turn off the \hypertarget{} feature? I have reviewed the documentation for pandoc and didn't see it anywhere.
I had the same need, and I am using the -auto_identifiers switch,
pandoc -r markdown-auto_identifiers -w latex test.md -o test.tex
That will remove both
\hypertarget{header-text}{%
and
\label{header-text}}
leaving only
\section{Header Text}
like you requested.
Source
There is no such switch. If you want different output, you'd either have to use a pandoc filter or, as #mb21 already noted, post-process the output.
Neither of these options is very good: using a filter to manually define header output will lose you all kinds of other pandoc features, like --top-level-division and support for unnumbered headers. Post-processing, on the other hand, tends to be brittle and difficult to get right.
Anyway, below is a panflute filter, which will replace headers with a custom command. Save it to a file and pass it to pypandoc via the filters option; this should give you the desired output.
from panflute import *
sectionTypes = ["section", "subsection", "subsubsection",
"paragraph", "subparagraph"]
def reduce_header(elem, doc):
if type(elem) == Header:
cmd = "\\%s{" % sectionTypes[elem.level - 1]
inlines = [RawInline(cmd, "tex")]
inlines.extend(elem.content)
inlines.append(RawInline("}", "tex"))
return Plain(*inlines)
if __name__ == "__main__":
run_filter(reduce_header)
I have a simple .csv file.
Is it possible to convert it to .xls using the command line tool ssconvert?
I would also need to specify the name of the sheet.
ln -s input.csv MySheetName
ssconvert MySheetName output.xls
The OP asked how to convert csv to xls while controlling the sheet name in the output.
The generated .xls file will use the name of the input CSV file as the sheet name, so you can symlink the .csv to anything you want (or rename the input file) to produce the desired result.
The previous answer implies that --list-exporters leads to a solution, but it merely lists exporter names with no information about their options, and no options are documented in the man page for xls-exporters. Experimentally, none of the exporters which can create .xls accept options (they fail with "The file saver does not take options" if you use -O).
Yes, it is possible.
You must specify names with extensions as input and output files.
For example:
ssconvert in.csv out.xls
Using --list-importers and --list-exporters options can take a look to available formats.
Is it possible to write a custom output writer for Pandoc?
For example, suppose I want to convert a document:
pandoc -f markdown -t myCustomMarkup asdf.md
Does Pandoc have a way I can specify the conversion rules for myCustomMarkup? (e.g. I could specify that text that had the 'bold' attribute should map to <bold>text</bold>, and so on for all features/attributes that Pandoc recognises).
Can anyone point me to some documentation as to how I can implement my own?
I can't seem to find any mention of this.
(Additionally, is there a way to "plug in" a writer defined in a file without having to (say) re-compile pandoc? e.g. pandoc -f markdown -t myCustomMarkup --writerpath=path/to/my/writer asdf.md)
There's no easy way to do this with current pandoc, but the next version of pandoc will contain code that allows you to write custom writers with a bit of easy lua scripting. (The code for this is already in the master branch in http://github.com/jgm/pandoc.) You'll be able to do
pandoc -t myfunkyformat.lua myfile.md
Here's an example of what a custom writer script might look like:
https://github.com/jgm/pandoc/blob/master/data/sample.lua
You can use the code now if you compile from source:
https://github.com/jgm/pandoc/wiki/Installing-the-development-version-of-pandoc