How to add latexbangla in book document class? - header

When I am using the latexbangla package
\usepackage[banglamainfont=Kalpurush, banglattfont=Siyam Rupali,
feature=0, changecounternumbering=0]{latexbangla}.
\newfontfamily{\bengalifontsf}[Script=Bengali]{Noto Sans Bengali}
in the following book documentation class, the header footer is not working.
MWE:
\documentclass[twoside,12pt,english]{book}
%\usepackage[banglamainfont=Kalpurush, banglattfont=Siyam Rupali, feature=0, changecounternumbering=0]{latexbangla} % to write bengali in latex
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{color}
\definecolor{marron}{RGB}{60,30,10}
\definecolor{darkgray}{RGB}{0,80,0}
\usepackage[demo]{graphicx}
\usepackage{wallpaper}
\usepackage{fancyhdr}
\usepackage{geometry}
\geometry{
tmargin=5cm,
bmargin=5cm,
lmargin=5cm,
rmargin=3cm,
headheight=1.5cm,
headsep=0.8cm,
footskip=0.5cm}
\usepackage{fourier-orns}
\newcommand{\ornpar}{\noindent \textcolor{darkgray}{ \raisebox{-1.9pt}[10pt][10pt]{\leafright} \hrulefill \raisebox{-1.9pt}[10pt][10pt]{\leafright \decofourleft \decothreeleft \aldineright \decotwo \floweroneleft \decoone}}}
\makeatletter
\def\headrule{{\color{darkgray}\raisebox{-2.1pt}[10pt][10pt]{\leafright} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{~~~\decofourleft \decotwo\decofourright~~~} \hrulefill \raisebox{-2.1pt}[10pt][10pt]{ \leafleft}}}
\makeatother
\fancyhf{}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}}
\newcommand{\estcab}[1]{\itshape\textcolor{marron}{\nouppercase #1}}
\fancyhead[LO]{\estcab{\rightmark}} % malo cuando no hay section ~~~ \thesection
\fancyfoot[RE]{\ornpar \\ \large \sffamily\bf \textcolor{darkgray}{\thepage ~~~ \reflectbox{\leafNE}} \hfill}
\pagestyle{fancy}
\renewcommand{\footnoterule}{\vspace{-0.5em}\noindent\textcolor{marron}{\decosix \raisebox{2.9pt}{\line(1,0){100}} \lefthand} \vspace{.5em} }
\usepackage[hang,splitrule]{footmisc}
\addtolength{\footskip}{0.5cm}
\setlength{\footnotemargin}{0.3cm}
\setlength{\footnotesep}{0.4cm}
%\newfontfamily{\bengalifontsf}[Script=Bengali]{Noto Sans Bengali}
\begin{document}
\tableofcontents
\chapter{First Chapter}
\newpage
\section{New Section}
\end{document}
Without using latexbangla package, everything is working fine. But I want to use latexbangla and the header footer should be the same as below.
How do I do it?

Related

Inline math font size and equations spacing in markdown to pdf conversion using pandoc

I'm using vim and markdown as an alternative to obsidian. I'm doing the conversion from markdown to pdf using pandoc and I would like to resemble as much as possible the pdf output of obsidian since I like how it looks.
In general I could make both pdf looks almost the same, but, I got two problems, the first is that the inline math font is too big, the second that the spacing before and after an equation is different.
Here are two screenshots, the first one being the pandoc output, the second the obsidian output.
To style the pdf I'm using a custom latex snippet which I include with pandoc -H style.tex ... during the pdf compilation, with this I was able to change the spacing between the text and the sections title as well as other things like page margins, etc. But I didn't find anything related to the math nor the equation for a template
I've also tried writing the equation as $\small \vec{E}$ but didn't work.
I think it has to be a way of changing the spacing from the latex template, I know that pandoc is using the unicode-math package to convert the latex equations but didn't find nothing related on how to change the spacing for the equations nor the font size.
EDIT: the style.tex file
% page setup
\usepackage[a4paper,
top=2cm,
bottom=1.75cm,
left=1.75cm,
right=1.75cm]{geometry}
\usepackage{titlesec}
\usepackage{fontspec}
% inline code (backticks in md)
% taken from https://jdhao.github.io/2019/05/30/markdown2pdf_pandoc/
\linespread{1.15}
\definecolor{bgcolor}{HTML}{e0e0e0}
\let\oldtexttt\texttt
\renewcommand{\texttt}[1]{
\colorbox{bgcolor}{\oldtexttt{#1}}
}
% change boldfont bold to extrabold
% \setmainfont[
% BoldFont={Inter-ExtraBold}
% ]{Inter}
% change regular font to light font
% \setmainfont{Inter light}
\newfontfamily\titlefont{Inter}[
UprightFont = *-Regular,
BoldFont = *-ExtraBold,
]
\newfontfamily\sectionsfont{Inter}[
UprightFont = *-Regular,
BoldFont = *-SemiBold,
]
\titleformat{\section}
{\titlefont\huge\bfseries}
{}
{0em}
{}
\titleformat{\subsection}
{\sectionsfont\LARGE\bfseries}
{}
{0em}
{}
\titleformat{\subsubsection}
{\sectionsfont\Large\bfseries}
{}
{0em}
{}
\titleformat{\paragraph}
{\sectionsfont\large\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\paragraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}
{0pt}{2.5ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titleformat{\subparagraph}
{\normalfont\large\bfseries}{\theparagraph}{1em}{}
\titlespacing*{\subparagraph}
{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
EDIT2: this is the .tex output part showed in the screenshot
taken from:
pandoc --pdf-engine=xelatex file.md -o file.tex
eléctrica que efectúa el campo sobre la partícula. se puede calcular entonces como:
\[\frac{w_{a \rightarrow b}}{q_{0}} = - \int_{a}^{b} \vec{e} \cdot d\vec{l} = v_{b} - v_{a} = v_{ab}\]
donde \({q_{0}}\) es una pequeña carga puntual, \(v_{a}\) y \(v_{b}\) el potencial por unidad de carga de los puntos \(a\) y \(b\) respectivamente, \(\vec{e}\) el valor del campo eléctrico

Latex printing Listings in black/white only, although the rest is printed in color?

I'm currently having trouble printing my generated PDF of a latex document. Although printing the whole document in color just fine, for some reason all my listings are printed in black and white only. In the PDF itself the listings are displayed in color, just as expected. Is this a normal latex behavior or am I doing something wrong? I'm using the regular listing package with the following defined style. Minimum working example:
\documentclass[ twoside,openright,numbers=noenddot,%
toc=bibliography,toc=listof,%
footinclude=false,headinclude=false,cleardoublepage=empty,%
BCOR=5mm,paper=a4,fontsize=11pt,%DIV=14,%
ngerman%
]{scrreprt}
\RequirePackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{~}
\RequirePackage[T1]{fontenc}
\newcommand{\currentVersion}{Version 2.1\xspace}
\newcounter{dummy}
\PassOptionsToPackage{ngerman}{babel}
\RequirePackage{babel}
\RequirePackage{csquotes}
\renewcaptionname{ngerman}{\listfigurename}{Abbildungen}
\renewcaptionname{ngerman}{\listtablename}{Tabellen}
\PassOptionsToPackage{fleqn}{amsmath}
\RequirePackage{amsmath}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=35mm,top=25mm,bottom=30mm}
\PassOptionsToPackage{dvipsnames}{xcolor}
\RequirePackage{xcolor}
\definecolor{ingwi}{cmyk}{.9,0,0,0}
\usepackage{textcomp}
\usepackage{scrhack}
\usepackage{xspace}
\usepackage{mparhack}
\PassOptionsToPackage{printonlyused}{acronym}
\usepackage{acronym}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[shadow]{todonotes}
\newcommand{\todox}[1]{\todo[inline, size=\small]{#1}}
\newcounter{todocounter}
\renewcommand{\todox}[2][]{\stepcounter{todocounter}\todo[inline, size=\small,caption={\thetodocounter: #2}, #1]{\renewcommand{\baselinestretch}{0.5}\selectfont\thetodocounter: #2\par}}
\usepackage{blindtext}
\counterwithout{footnote}{chapter}
\usepackage{tabularx}
\setlength{\extrarowheight}{3pt}
\usepackage{caption}
\captionsetup{format=plain,indention=1em,font=small}
\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{listings}
\lstset{emph={trueIndex,root},emphstyle=\color{BlueViolet}}%\underbar} % for special keywords
\lstset{language=[LaTeX]Tex,%C++,
keywordstyle=\color{RoyalBlue},%\bfseries,
basicstyle=\small\ttfamily,
%identifierstyle=\color{NavyBlue},
commentstyle=\color{Green}\ttfamily,
stringstyle=\rmfamily,
numbers=none,%left,%
numberstyle=\scriptsize,%\tiny
stepnumber=5,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
% frameround=ftff,
frame=single,
texcl=true,
belowcaptionskip=.75\baselineskip
%frame=L
}
\lstdefinestyle{Java}{
belowcaptionskip=1\baselineskip,
breaklines=true,
xleftmargin=\parindent,
language=Java,
texcl=true,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{blue},
commentstyle=\itshape\color{black!50!white},
morecomment=[s][\color{white}]{---}{+++},
morecomment=[s][\color{orange!90!black}]{#}{\ },
identifierstyle=\color{black},
stringstyle=\color{green!60!black}}
\lstdefinestyle{Xml}{
belowcaptionskip=1\baselineskip,
breaklines=true,
xleftmargin=\parindent,
language=Java,
texcl=true,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
identifierstyle=\bfseries\color{black},
commentstyle=\itshape\color{black!50!white},
stringstyle=\color{green!60!black}}
\PassOptionsToPackage{pdftex,hyperfootnotes=false,pdfpagelabels}{hyperref}
\usepackage{hyperref}
\pdfcompresslevel=9
\pdfadjustspacing=1
\PassOptionsToPackage{pdftex}{graphicx}
\usepackage{graphicx}
\hypersetup{%
%draft, % = no hyperlinking at all (useful in b/w printouts)
pdfstartpage=1, pdfstartview=Fit,%
colorlinks=true, linktocpage=true,
%urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
%urlcolor=brown, linkcolor=RoyalBlue, citecolor=green, %pagecolor=RoyalBlue,%
% uncomment the following line if you want to have black links (e.g., for printing)
colorlinks=false, pdfborder={0 0 0},
breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
hypertexnames=true, pdfhighlight=/O,%nesting=true,%frenchlinks,%
pdftitle={test},%
pdfauthor={\textcopyright\ test, test},%
pdfsubject={},%
pdfkeywords={},%
pdfcreator={pdfLaTeX},%
pdfproducer={LaTeX with hyperref}%
}
\makeatletter
\#ifpackageloaded{babel}%
{%
\addto\extrasamerican{%
\renewcommand*{\figureautorefname}{Figure}%
\renewcommand*{\tableautorefname}{Table}%
\renewcommand*{\partautorefname}{Part}%
\renewcommand*{\chapterautorefname}{Chapter}%
\renewcommand*{\sectionautorefname}{Section}%
\renewcommand*{\subsectionautorefname}{Section}%
\renewcommand*{\subsubsectionautorefname}{Section}%
}%
\addto\extrasngerman{%
\renewcommand*{\chapterautorefname}{Kapitel}%
\renewcommand*{\sectionautorefname}{Abschnitt}%
\renewcommand*{\subsectionautorefname}{Abschnitt}%
\renewcommand*{\subsubsectionautorefname}{Abschnitt}%
\renewcommand*{\paragraphautorefname}{Absatz}%
\renewcommand*{\subparagraphautorefname}{Absatz}%
\renewcommand*{\footnoteautorefname}{Fu\"snote}%
\renewcommand*{\FancyVerbLineautorefname}{Zeile}%
\renewcommand*{\theoremautorefname}{Theorem}%
\renewcommand*{\appendixautorefname}{Anhang}%
\renewcommand*{\equationautorefname}{Gleichung}%
\renewcommand*{\itemautorefname}{Punkt}%
}
\providecommand{\subfigureautorefname}{\figureautorefname}%
}{\relax}
\makeatother
\PassOptionsToPackage{l2tabu,orthodox,abort}{nag}
\usepackage{nag}
\usepackage{enumitem}
\setdescription{font=\normalfont\bfseries}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage{mathpazo}
\setkomafont{disposition}{\bfseries}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand{\code}[1]{\texttt{\em{#1}}}
\begin{document}
\frenchspacing
\raggedbottom
\selectlanguage{ngerman}
\pagenumbering{roman}
\pagestyle{plain}
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{headings}
\begin{minipage}[chbt]{0.95\textwidth}
\begin{lstlisting}[caption=test,captionpos=b,label={lst:example_facade},style=Java]
public class ExampleFacade implements CrudFacade<ExampleEntity> {
#Override
public ExampleEntity getSpecificEntity(String id) throws NoSuchDataSetException {
// retrieve specific entity from database
// ...
}
}
\end{lstlisting}
\end{minipage}
\begin{figure}[hbt]
\centering
\includegraphics[width=0.6\textwidth]{insert your picture here}
\caption{test}
\label{fig:lifecycle}
\end{figure}
\end{document}
Download my PDF: https://www.file-upload.net/download-14777480/test.pdf.html
Edit: It seems as though this is only a problem with my particular printer for some reason I can't explain at all. When using the printer of a friend it works just fine, even with the original PDF, not just the working example. I'm using the Brother DCP-L3550CDW.

Blank LatexPDF File issue with custom Latex Style with SPHINX

Recently I've created my PDF file correctly as in style formatting.
But now I've got the issue that my RST files from Sphinx are not included.
Maybe that someone knows how I include the RST content into the custom PREAMBLE - sty file content
main.sty
\PassOptionsToPackage{english}{babel}
\usepackage{amsmath}
\usepackage{color,pxfonts,fix-cm}
\usepackage{latexsym}
\usepackage[mathletters]{ucs}
\DeclareUnicodeCharacter{32}{$\ $}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pict2e}
\usepackage{wasysym}
\usepackage{tikz}
\pagestyle{empty}
\geometry{left=0.2in, top=0.5in, paperwidth=595pt, paperheight=878pt}
\begin{document}
\definecolor{color_93343}{rgb}{0.25098,0.25098,0.25098}
\definecolor{color_217206}{rgb}{0.737255,0.839216,0.443137}
\begin{tikzpicture}[overlay]\path(0pt,0pt);\end{tikzpicture}
\begin{picture}(-5,0)(2.5,0)
\put(-15,-837.4999){\includegraphics[width=596.25pt,height=887.25pt]{latexImage_ab7aceb12f4add82da5ce423202fd278.png}}
\put(55.775,-99.78003){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.525,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(282.38,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(509.48,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.775,-823.5){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.775,-118.05){\fontsize{16}{1}\usefont{T1}{cmr}{b}{n}\selectfont\color{color_217206} }
\put(55.775,-150.3){\fontsize{16}{1}\usefont{T1}{cmr}{b}{n}\selectfont\color{color_217206} }
\end{picture}
\end{document}
[SPHINX] Conf.py:
latex_engine = 'pdflatex'
latex_additional_files = [
'latexImage_ab7aceb12f4add82da5ce423202fd278.png',
'main.sty'
]
latex_elements = {
# Additional stuff for the LaTeX preamble.
'extraclassoptions': 'openany',
'preamble' : r"""
\usepackage{main}
\renewcommand{\subtitle}{%s}
""" % (project)
}
It creates the latex PDF with the correct custom styling.. But all the RST content is not included.
I also tried it with 'latex_documents' Creation method within the conf.py but resulted also with a blanko PDF file.

using dot in orgmode to create latex-pdf, how can I set the grap size?

How can I set the graph or image size in my generated pdf?
Using this code in org-mode:
#+BEGIN_SRC dot :file hallo1_1_1.png
digraph hallo1_1_1 {
A [shape = "circle",style=filled, fillcolor=yellow];
}
#+END_SRC
A giant page filling yellow pixeled circle is drawn.
How can I set image size and resolution?
Thank you.
You can always add specific LaTeX (or HTML) attributes to the result of a source block:
#+BEGIN_SRC dot :file hallo1_1_1.png
digraph hallo1_1_1 {
A [shape = "circle",style=filled, fillcolor=yellow];
}
#+END_SRC
#+attr_latex: :width 2cm
#+RESULTS:
[[file:hallo1_1_1.png]]
Documentation here.
You can set dpi option in header.
#+headers: :file file.gif :cmdline -Tgif -Gdpi=100
#+begin_src dot
digraph g {
...
}
#+end_src

Unicode characters not showing in Zend_Pdf?

require_once 'Zend/Pdf.php';
$pdf = new Zend_Pdf();
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
$pdf->pages[] = $page;
$page->setFont(Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA), 10);
$page->drawText("Bogus Russian: это фигня", 100, 400, "UTF-8");
$pdfData = $pdf->render();
header("Content-Disposition: inline; filename=output.pdf");
header("Content-type: application/x-pdf");
echo $pdfData;
I can't get the Russian characters to show up! I've managed to get them to show up as:
Russian: ???????????
Russian: ÐоммÑнÐ
Russian:
and
Russian: ><
This post explains it better:
How to generate pdf files _with_ utf-8 multibyte characters using Zend Framework
Essentially the built-in fonts (eg. Zend_Pdf_Font::FONT_HELVETICA) don't contain enough info, so you need to attach a font ttf file with the pdf, and set your script to use that font.
$font = Zend_Pdf_Font::fontWithPath('/Library/Fonts/Times.ttf');
$pdfPage->setFont($font, 36);
Perhaps this will answer your question:
How to generate pdf files _with_ utf-8 multibyte characters using Zend Framework
By the looks of it the default fonts do not have all the utf-8 characters...you may have to load external TTF...