Use makeindex with pandoc while creating a PDF from a Markdown file - pdf

I have got a markdown file and like to convert it to pdf. I need an index. For this I found makeindx
I am using this command for creating a pdf from a markdown file:
pandoc "test.md" \
--from markdown --to latex \
--toc \
--toc-depth=1 \
--include-in-header index.tex \
--include-in-header chapter_break.tex \
--include-in-header inline_code.tex \
--include-in-header bullet_style.tex \
--include-in-header pdf_properties.tex \
--highlight-style pygments.theme \
-V toc-title='Inhaltsverzeichnis' \
-V title='Mein Titel' \
-V author='Ich' \
-V book=true \
-V date="24. Mai 2021" \
-V classoption='oneside' \
--template ./eisvogel.latex \
--listings \
-o "test.pdf"
The template Eisvogel I found on github. I asked the question in an issue here, too.
The file index.tex has this content:
\usepackage{makeidx}
\makeindex
In my document I use
Installation\index{Installation}
and at the end
\printindex
Unfortunately, no index is printed.
Am I doing something wrong?
Edit I found a temporarily solution:
First I create a *.latex.
pandoc JoomlaEnPDF.en.md \
-o 1.en.tex \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Content" \
--top-level-division="part" \
--number-sections \
Then I run the commands manually.
pdflatex 1.en.tex
pdflatex 1.en.tex
makeindex 1.en.idx
cat ./1.en.ind >> JoomlaEnPDF.en.md
Then I create the pdf
pandoc JoomlaEnPDF.en.md \
-o 1.en.pdf \
--from markdown \
--template ./eisvogel.latex \
--listings \
--toc \
--toc-depth=1 \
-V toc-title="Table of Contents" \
--top-level-division="part" \
--number-sections \

Related

How to run 'run_squad.py' on google colab? It gives 'invalid syntax' error

I downloaded the file first using:
!curl -L -O https://github.com/huggingface/transformers/blob/master/examples/legacy/question-answering/run_squad.py
Then used following code:
!python run_squad.py \
--model_type bert \
--model_name_or_path bert-base-uncased \
--output_dir models/bert/ \
--data_dir data/squad \
--overwrite_output_dir \
--overwrite_cache \
--do_train \
--train_file /content/train.json \
--version_2_with_negative \
--do_lower_case \
--do_eval \
--predict_file /content/val.json \
--per_gpu_train_batch_size 2 \
--learning_rate 3e-5 \
--num_train_epochs 2.0 \
--max_seq_length 384 \
--doc_stride 128 \
--threads 10 \
--save_steps 5000
Also tried following:
!python run_squad.py \
--model_type bert \
--model_name_or_path bert-base-cased \
--do_train \
--do_eval \
--do_lower_case \
--train_file /content/train.json \
--predict_file /content/val.json \
--per_gpu_train_batch_size 12 \
--learning_rate 3e-5 \
--num_train_epochs 2.0 \
--max_seq_length 584 \
--doc_stride 128 \
--output_dir /content/
The error says in both the codes:
File "run_squad.py", line 7
^ SyntaxError: invalid syntax
What exactly is the issue? How can I run the .py file?
SOLVED: It was giving error because I was downloading the github link rather than the script in github. Once I copied and used 'Raw' link to download the script, the code ran.

How to convert configure options for use with cmake

I have a script for building a project that I need to upgrade from using configure to cmake. The original configure command is
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--with-clang \
--prefix=$PREFIX \
--libdir=$PREFIX/lib${LIBDIRSUFFIX} \
--incdir=$PREFIX/include \
--mandir=$PREFIX/man/man1 \
--etcdir=$PREFIX/etc/root \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--enable-roofit \
--enable-unuran \
--disable-builtin-freetype \
--disable-builtin-ftgl \
--disable-builtin-glew \
--disable-builtin-pcre \
--disable-builtin-zlib \
--disable-builtin-lzma \
$GSL_FLAGS \
$FFTW_FLAGS \
$QT_FLAGS \
--enable-shared \
--build=$ARCH-slackware-linux
I am not familiar enough with cmake to know how to do the equivalent. I would prefer a command line option but am open to modifying the CMakeLists.txt file as well.

OCLint got compile errors in html report file, but my project build success. WHY

xcodebuild -workspace ${myworkspace} -scheme ${myscheme} \
-sdk iphonesimulator \
-derivedDataPath ./build/derivedData \
-configuration Debug \
COMPILER_INDEX_STORE_ENABLE=NO \
| xcpretty -r json-compilation-database -o compile_commands.json
I run the command line above to build my project, it build success, but when i run the command line below to generate oclint html report file, get 15 compiler errors.
oclint-json-compilation-database -e Pods -- \
-extra-arg=-Wno-error=everything \
-report-type html \
-rc LONG_LINE=200 \
-rule MultipleUnaryOperator \
-max-priority-1=0 \
-max-priority-2=10 \
-max-priority-3=20 \
-o ./oclint_report.html
try this
oclint-json-compilation-database <YOUR OPTIONS HERE> -- -extra-arg=-Wno-everything
as:
oclint-json-compilation-database -e Pods -- \
-extra-arg=-Wno-error=everything \
-report-type html \
-rc LONG_LINE=200 \
-rule MultipleUnaryOperator \
-max-priority-1=0 \
-max-priority-2=10 \
-max-priority-3=20 \
-extra-arg=-Wno-everything \
-o ./oclint_report.html

yum stopped working with error No module named transactioninfo

Removed the following files by mistake and as a result yum stopped working.
Any idea what rpms exactly we need to re-install?
./abrt_exception_handler.pyo
./abrt_exception_handler.pyc
./abrt.pth
./abrt_exception_handler.py
./yum/sqlitesack.pyo
./yum/rpmsack.pyo
./yum/packages.pyo
./yum/misc.pyo
./yum/metalink.pyo
./yum/__init__.pyo
./yum/history.pyo
./yum/depsolve.pyo
./rpmUtils/miscutils.pyo
./yum/yumRepo.pyo
./yum/yumRepo.pyc
./yum/yumRepo.py
./yum/update_md.pyo
./yum/update_md.pyc
./yum/update_md.py
./yum/transactioninfo.pyo
./yum/transactioninfo.pyc
./yum/transactioninfo.py
./yum/sqlutils.pyo
./yum/sqlutils.pyc
./yum/sqlutils.py
Ok, found the solution. Since I don't know exactly which python modules belongs to which rpm, I did a re-install of most of the dependent rpms. Here it goes.
#!/bin/bash
for file in \
elfutils-0.152-1.el6.x86_64.rpm \
elfutils-libs-0.152-1.el6.x86_64.rpm \
expat-2.0.1-11.el6_2.x86_64.rpm \
gmp-4.3.1-7.el6_2.2.x86_64.rpm \
libxml2-2.7.6-8.el6_3.4.x86_64.rpm \
libxml2-python-2.7.6-8.el6_3.4.x86_64.rpm \
m2crypto-0.20.2-9.el6.x86_64.rpm \
python-2.6.6-36.el6.x86_64.rpm \
python-iniparse-0.3.1-2.1.el6.noarch.rpm \
python-urlgrabber-3.9.1-8.el6.noarch.rpm \
readline-6.0-4.el6.x86_64.rpm \
rpm-4.8.0-32.el6.x86_64.rpm \
rpm-libs-4.8.0-32.el6.x86_64.rpm \
rpm-python-4.8.0-32.el6.x86_64.rpm \
sqlite-3.6.20-1.el6.x86_64.rpm \
yum-3.2.29-40.el6.centos.noarch.rpm \
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
do wget http://mirror.centos.org/centos-6/6/os/x86_64/Packages/$file;
done
rpm -Uvh *.rpm --force

(How) can I set an offset when converting PDF to PCL with Ghostscript?

I need to shift the whole page content of a PDF a certain distance down and to the left when converting it to PCL.
I've already found how to do it with PDF to PDF:
How can I shift page images in PDF files more to the left or to the right?
Is there somehing similar for the PCL conversion?
Now I convert with the following command:
gswin32c.exe \
-q \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pxlmono \
-dDuplex=false \
-dTumble=false \
-sPAPERSIZE=a4 \
-dMediaPosition=4 \
-sOutputFile="d:\out.pcl" \
-f"d:\in.pdf" \
-c \
-quit
Is there a possibility to do it directly or do I need to shift the content in a PDF to PDF conversion first (like in the linked question) and then convert it to pcl in a second conversion step?
I don't think it would work with the direct conversion of PDF => PCL.
You should do it in 2 steps, then it works:
first shift the contents on the PDF pages,
convert the PDF with the shifted pages to PCL.
First command:
gs \
-sDEVICE=pdfwrite \
-o pdf-shifted-by-1-inch-to-left-2-inches-to-top.pdf \
-g8420x5950 \
-c "<</PageOffset [-72 144]>> setpagedevice" \
-f input.pdf
Second command:
gs \
-sDEVICE=pxlmono \
-o pcl-output.pcl \
-sPAPERSIZE=a4 \
pdf-shifted-by-1-inch-to-left-2-inches-to-top.pdf