I am trying to add a custom latex template for pandoc
I know that pandoc templates go in ~/.pandoc/templates
and I confirmed the pandoc directory location by typing pandoc --v - it says pandoc is in ~/.pandoc
but when I do cd ~/.pandoc:
-bash: cd: /Users/[Name]/.pandoc: No such file or directory
According the pandoc man page I can set a different path for pandoc data files using --data-dir=DIRECTORY, but when I try build a file this way, e.g.
pandoc file.md -o file.pdf --data-dir=~/Library/texmf/tex/latex --template=mytemplate.latex
it throws the error
pandoc: Could not find data file templates/mytemplate.latex
which I assume means the data directory command is ignored.
Why can't I access my pandoc directory?
You are indeed expected to create the ~/.pandoc directory if it doesn't exist already. For example for a default latex template:
mkdir -p ~/.pandoc/templates
pandoc -D latex > ~/.pandoc/templates/default.latex
The --template option looks for files relative to the current directory (pwd), or "if not found, pandoc will search for it in the templates subdirectory of the user data directory" (~/.pandoc/templates for --data-dir=~/.pandoc, which is the default).
Which is where your error comes from as there's probably no file /Library/texmf/tex/latex/templates/mytemplate.latex.
Related
How do I download files in the current working directory with youtube-dl?
I want something like youtube-dl -o pwd "https://www.youtube.com/watch?v=UGHVseYRXDo" to work.
My config currently looks like:
-o ~/Downloads/%(title)s-%(id)s.%(ext)s
--format mp4
I'd like to retain the file name and format properties, but change the download location to wherever pwd is.
The option -o filename is optional, and you don't have to specify the working directory as this is the default one. But if you prefer to specify it, you could use a command substitution `pwd` or $(pwd) so your command could be eg:
$ youtube-dl -o "$(pwd)/%(title)s.%(ext)s" url
Of course you are free to put any other options like those in your configuration file.
I can easily do this in LINUX using an includes.txt file:
pandoc -s $(cat includes.txt) -o index.html
where includes.txt contains:
file1.md
file3.md
file2.md
The problem is that I now have to do the equivalent in Windows and cannot figure out how to concatenate the Markdown files in the order specified in the includes.txt file and then pass this to Pandoc.
Any help is appreciated.
You could create a file defaults.yaml with the following content:
input-files:
- file1.md
- file3.md
- file2.md
Then call pandoc with pandoc --defaults defaults.yaml ….
After a short research, I found that you can do the equivalent operation in Windows environment using Pandoc.
Download and install Pandoc using the following link. You should select pandoc-2.9.2-windows-x86_64.msi
Pandoc
After successful installation of Pandoc, open powershell to check if the program is successfully installed by running the following command.
pandoc --version
Now, running the provided command from your original post will work in Windows environment.
pandoc -s $(cat includes.txt) -o index.html
I have a number of Markdown files which I am converting to PDF using Pandoc - including folding in some header files with LaTeX options.
This works if I create the PDF in a single step (MD → PDF), however, I need to perform some additional steps on the intermediate LaTeX file so I am trying to split the Pandoc process into two steps (MD → TEX → PDF) - which produces an "Undefined Control Sequence" error.
I have compared the .tex file produced by one-step-Pandoc with the two-step version and they are identical - including the relevant \usepackage commands for the LaTeX packages that produce the error.
I am running on Windows, and have updated Pandoc to 2.7.3 and updated all my MiKTeX packages this morning.
Minimal test files that produce this error:
test.md:
% Title
% Author
% Date
Body text
title.tex
\setmainfont{Times New Roman}\fontsize{11pt}{11pt}\selectfont
\sectionfont{
\setmainfont{Arial}
\fontsize{32pt}{32pt}
\selectfont
}
When I use a single step command, the PDF produces correctly without issue:
> pandoc test.md options.yaml -o test.pdf -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex --pdf-engine=lualatex
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
When run in two steps:
> pandoc test.md options.yaml -o test.tex -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex
> pandoc test.tex -o test.pdf -f latex --pdf-engine=lualatex
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
lualatex: warning: running with administrator privileges
Error producing PDF.
! Undefined control sequence.
l.81 \sectionfont
The second step should simply be:
> lualatex test.tex
By using pandoc to go from LaTeX to PDF you potentially lose information (because pandoc cannot represent all of TeX and more importantly, pandoc will use it's own template.)
I have a .bin which i am trying to unzip programatically. The directory is a temp directory in which the.bin file is saved.
I have tried to the following
change the permission of bin files by typing.
chmod -c 777 filenam.bin.
now run the bin file by typing
here is a ruby code which i have
%x(gunzip #{label_path})
using above gunzip gives me this error
unknown suffix -- ignored
I shows error as illegal option c.
Can anyone help. Thanks.
gunzip has an option -S to specify a suffix of the file to be unzipped:
gunzip -S .bin filenam.bin
The above will produce file filenam in the same directory.
I am using Doxygen for creating documentation of my project. I am able to create Latex file for my documentation, but how to convert it to pdf. I found in the manual of Doxygen that we need to give a make pdf command in outputdir. I tried this but i used to get following error.
$ make pdf
del /s/y *.ps *.dvi *.aux *.toc *.idx *.ind *.ilg *.log *.out refman.pdf
del: not found
make: * [clean] Error 127
Apparently you generated the output on a Windows machine, and are now running make from a Unix/Linux machine. This causes your problem.
I suggest to edit the Makefile in the latex output directory and replace "del" by "rm -rf" and then rerun make. Alternatively, you could generate the latex output using the Unix/Linux version of doxygen. Then doxygen will put "rm -rf" in the Makefile.
cd /to/your/textpath/.tex
then pdflatex refman.tex