Sample Markdown used as a Reproducible Example (GitHub hyperlink)
I pasted the markdown from the hyperlink above into the Atom text editor and saved it as a documentation.md file. I can run the following two seperate Pandoc commands and each of them works to reduce the margins on my pdf -and- increase the font size to 12 on the output pdf.
pandoc -s -V documentation.md geometry:margin=1in -o documentation.pdf
pandoc -s -V documentation.md fontsize=12 -o documentation.pdf
When I combine the two commands into the following I get the error shown below. Is there a problem in my Pandoc syntax?
pandoc -s -V documentation.md geometry:margin=1in fontsize=12 -o documentation.pdf
pandoc geometry:margin=1in openBinaryFile: does not exist (No such file or
directory)
Try this:
pandoc documentation.md -V geometry:margin=1in -V fontsize:12pt -s -o documentation.pdf
Pandoc's FAQs state:
How do I change the margins in PDF output?
The option
-V geometry:margin=1in
will set the margins to one inch on each side.
Note that geometry:margin=1in is the value of the -V flag. However, you have the filename documentation.md between the flag and its value. Therefore, you are causing the value of the flag to be documentation.md and geometry:margin=1in is assumed to be a filename. After all, any string of text no preceded by a flag should be a filename (which explains the "No such file or directory" error).
By way of explanation, the documentation for the -V flag gives this format:
-V KEY[:VAL]
Note that the brackets in [:VAL] indicate that that part is optional. So -V KEY is completely valid with no value, which means that -V documentation.md resulted in documentation.md being the KEY of the -V flag (with a default VAL of true as per the docs).
Admittedly, -V geometry:margin=1in is an especially weird case and its easy to see how one might be confused by it. In this case however, -V is the flag, geometry is the "KEY" and margin=1in is the "VAL". I realize that margin=1in looks like a KEY=VAL, but in this instance it is all a "VAL" on its own. Presumably, Pandoc does some further processing on it later to break the "VAL" up into its parts.
Of course, fontsize is another variable, so you need a second -V flag to define that variable: -V fontsize:12pt.
Finally, the -s flag does not accept a value, so I moved it so that that is clear.
You have to write the -V twice as well, directly in front of the variable options you want to set:
pandoc -s documentation.md -V geometry:margin=1in -V fontsize=12 -o documentation.pdf
see http://pandoc.org/getting-started.html and http://pandoc.org/MANUAL.html
Related
I was searching for a change that included "foreach" so I used this Mercurial command:
$ hg grep -r "user(mjh) & public() & date(-30)" --diff -i foreach
and it does return the hits where "foreach" was added and removed.
However, I'd like to know the actual commit hashes too. If I add a template:
$ hg grep ... -T '{date|shortdate}\n{node|short}\n{desc|firstline}\n\n'
then I get the commit hash and description as expected, but then I don't see the changed files listed.
Is there a template to capture the output of hg grep? The {files} template lists the files associated with a commit, but that's not the actual grep output. Is there an iterable template keyword available for the grep results?
Please, re-read carefully hg help grep -v (-v is important option), note the following part (new and unexpected for me also)
The following keywords are supported in addition to the common
template
keywords and functions. See also 'hg help templates'.
change String. Character denoting insertion "+" or removal "-".
Available if "--diff" is specified.
lineno Integer. Line number of the match.
path String. Repository-absolute path of the file.
texts List of text chunks.
After it you'll be able to repeat (so-so, because some details will differ slightly) default output of grep in you template
>hg grep --diff -i -r 1166 to_try
>hg grep --diff -i -r 1166 -T "{path}:{rev}:{change}:{texts}\n" to_try
hggit/compat.py:1166:-: for args in parameters_to_try:
hggit/compat.py:1166:+: for (args, kwargs) in parameters_to_try:
and after replacing {rev} by {node|short}
>hg grep --diff -i -r 1166 -T "{path}:{node|short}:{change}:{texts}\n" to_try
hggit/compat.py:f6cef55e6aeb:-: for args in parameters_to_try:
hggit/compat.py:f6cef55e6aeb:+: for (args, kwargs) in parameters_to_try:
is there any lvm.conf editor?
I'm trying to set global_filter, use_lvmtad and some other options, currently using sed:
sed -i /etc/lvm/lvm.conf \
-e "s/use_lvmetad = 1/use_lvmetad = 0/" \
-e "/^ *[^#] *global_filter/d" \
-e "/^devices {/a\ global_filter = [ \"r|/dev/drbd.*|\", \"r|/dev/dm-.*|\", \"r|/dev/zd.*|\" ]"
but I don't like this too much, is there any better way?
I found only lvmconfig tool, but it can only display certain configuration sections, and can't edit them.
If you using Ubuntu variant then you can use the LVM GUI to configure and manage the LVM. Refer this link
It seems that augtool is exactly what I was looking for.
These two packages should be enough to proper processing lvm.conf file:
apt install augeas-tools augeas-lenses
Example usage:
augtool print /files/etc/lvm/lvm.conf
And you should get the whole parse tree on stdout.
If the parser fails you won’t get any output, print the error message using:
augtool print /files/etc/lvm/lvm.conf/error
The augtool equivalent for the sed command from the original question:
augtool -s <<EOT
set /files/etc/lvm/lvm.conf/global/dict/use_lvmetad/int "0"
rm /files/etc/lvm/lvm.conf/devices/dict/global_filter
set /files/etc/lvm/lvm.conf/devices/dict/global_filter/list/0/str "r|^/dev/drbd.*|"
set /files/etc/lvm/lvm.conf/devices/dict/global_filter/list/1/str "r|/dev/dm-.*|"
set /files/etc/lvm/lvm.conf/devices/dict/global_filter/list/2/str "r|/dev/zd.*|"
EOT
I am trying to spellcheck a LaTeX document (using Word), and use OpenDetex to convert it to plain text. The command line with default parameters:
$ detex foo.tex > foo.txt
Problem: some garbage, especially bibliography ids from \citep{} and \citet{} commands stay in the text.
How can I exclude these specific tags?
The -c option only excludes \cite, but not \citep and \citet.
I tried using the -e option like:
$ detex -e citep foo.tex > foo.txt
to no avail.
The documentation is a bit vague on that:
detex [-e environment-list] [-c] [-l] [-n] [-s] [-t] [-w] [file[.tex] ]
...
-e <env-list> list of LaTeX environments to ignore\n
...
Any ideas how to make it work?
\citep and \citet are not LaTeX environments, they are commands, and as such the -e flag of detex has no effect on it. The flag -e is only for environments.
The new version of detex 2.8.2 that you can obtain here.
as long as the commands (\citep and \citet) do not start at the first character in a line -- that is a bug and will be fixed.
On my MacBook (OSX Mountain Lion), I used to use this Pandoc command to convert Markdown to PDF:
$ markdown2pdf -N -o pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
But markdown2pdf no longer works, and --xetex option in markdown2pdf -N -o ../../Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate-headers-garamond_date.tex is deprecated.
If I do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --xetex --toc --template=mytemplate.tex myfile.md
I get this:
pandoc: unrecognized option `--xetex'
But if I take out --xetex and do this:
$ pandoc -N -o Desktop/pandoc_output.pdf --toc --template=mytemplate.tex myfile.md
then I get this:
pandoc: Error producing PDF from TeX source.
! Package hyperref Error: Wrong driver option `xetex',
(hyperref) because XeTeX is not detected.
See the hyperref package documentation for explanation.
Type H <return> for immediate help.
...
l.3925 \ProcessKeyvalOptions{Hyp}
What's the solution?
Try --latex-engine=xelatex instead of --xetex
The prior answers to this question were helpful to me, as I had installed pandoc a couple years ago, but never Tex Live. Consequently I had no idea if I had installed it correctly, so putting in the entire path helped me to see that it was working, as follows:
pandoc --latex-engine=/usr/local/texlive/2012basic/bin/universal-darwin/xelatex
This is the default install location for the BasicTex setup which you download from the Pandoc install page.
I had also forgotten about using pandoc -D Latex >my-latex-template.tex to generate a template. After giving a .tex template instead of my .html one (which caused a 'you don't have BEGIN {' error) , I got .PDF: In other words, the default template worked.
Also, I had inaccurately entered -t pdf (not shown above) to set pdf as an output format, but this was not correct. The output format is Latex, which is then translated to PDF. It is not necessary to specify an output format with the dash -t option.
I hope this record of my minor stumbles saves someone some time.
See the pandoc User's Guide (or man page) for the --latex-engine option.
I want to filter the doxygen warnings with grep, to supress the undocumented parameter warning for certain parameters. I am trying this:
doxygen doxycfgfile | grep -v "parameter x"
however this seems to have absolutely no effect on the output. Neither the lines containing parameter x are suppressed nor all other lines. The output appears to be exactly the same.
I am using tcsh.
Presumably this is because the undocumented parameter warning messages are being written to standard error (stderr), rather than standard out (stdout). With the pipe (|) you are only piping stdout to grep's input.
You could try doing something like
doxygen doxycfgfile |& grep -v "parameter x"
From the advanced bash scripting guide:
If |& is used, the standard error of command1 is connected to command2's standard input through the pipe; it is shorthand for 2>&1 |.
Note, this was added in Bash 4, so for earlier versions you will have you use 2>&1 | in place of |&.
Alternatively, you could just get rid of the standard error output, using something like
doxygen doxycfgfile 2>/dev/null
This answer on askubuntu was the source for my answer.