Include latex package option before documentclass in RMarkdown beamer presentation - latex

I am trying to compile the following beamer presentation in rmarkdown. But when it tries to render rmarkdown document an error occurs
! LaTeX Error: Option clash for package xcolor.
I searched Internet and found out that I need to include \PassOptionsToPackage{table}{xcolor} before the line \documentclass. Applying options to already loaded package and also see here
How do I do it in RMarkdown?
---
title: "My report"
output:
beamer_presentation:
keep_tex: true
header-includes:
- \usepackage{booktabs}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
- \usepackage[table]{xcolor}
---
```{r setup, include=FALSE}
library(knitr)
library(kableExtra)
knitr::opts_chunk$set(echo = FALSE)
```
```{r positioned_table}
dt <- mtcars[1:5, 1:6]
kable(dt) %>%
kable_styling("striped", full_width = F) %>%
column_spec(5:7, bold = T) %>%
row_spec(3:5, bold = T, color = "white", background = "#D7261E")
```
The resulting .tex file is
\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[ignorenonframetext,]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
\usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{part title}
\usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{part title}
\usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
\AtBeginPart{
\frame{\partpage}
}
\AtBeginSection{
\ifbibliography
\else
\frame{\sectionpage}
\fi
}
\AtBeginSubsection{
\frame{\subsectionpage}
}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
\usepackage{unicode-math}
\defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
pdftitle={My report},
pdfborder={0 0 0},
breaklinks=true}
\urlstyle{same} % don't use monospace font for urls
\newif\ifbibliography
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}
% set default figure placement to htbp
\makeatletter
\def\fps#figure{htbp}
\makeatother
\usepackage{booktabs}
\usepackage{tabu}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage[normalem]{ulem}
\usepackage[table]{xcolor}
\title{My report}
\date{}
\begin{document}
\frame{\titlepage}
\begin{frame}
\begin{table}[H]
\centering
\begin{tabular}{l|r|r|r|>{\bfseries}r|>{\bfseries}r|>{\bfseries}r}
\hline
& mpg & cyl & disp & hp & drat & wt\\
\hline
Mazda RX4 & 21.0 & 6 & 160 & 110 & 3.90 & 2.620\\
\hline
Mazda RX4 Wag & 21.0 & 6 & 160 & 110 & 3.90 & 2.875\\
\hline
\rowcolor[HTML]{D7261E} \textcolor{white}{\textbf{Datsun 710}} & \textcolor{white}{\textbf{22.8}} & \textcolor{white}{\textbf{4}} & \textcolor{white}{\textbf{108}} & \textcolor{white}{\textbf{93}} & \textcolor{white}{\textbf{3.85}} & \textcolor{white}{\textbf{2.320}}\\
\hline
\rowcolor[HTML]{D7261E} \textcolor{white}{\textbf{Hornet 4 Drive}} & \textcolor{white}{\textbf{21.4}} & \textcolor{white}{\textbf{6}} & \textcolor{white}{\textbf{258}} & \textcolor{white}{\textbf{110}} & \textcolor{white}{\textbf{3.08}} & \textcolor{white}{\textbf{3.215}}\\
\hline
\rowcolor[HTML]{D7261E} \textcolor{white}{\textbf{Hornet Sportabout}} & \textcolor{white}{\textbf{18.7}} & \textcolor{white}{\textbf{8}} & \textcolor{white}{\textbf{360}} & \textcolor{white}{\textbf{175}} & \textcolor{white}{\textbf{3.15}} & \textcolor{white}{\textbf{3.440}}\\
\hline
\end{tabular}
\end{table}
\end{frame}
\end{document}

Using very usefull comment from #samcarter, I found the exact answer. All I need is the following yaml header in my rmarkdown document:
---
title: "My report"
output:
beamer_presentation:
keep_tex: true
classoption: xcolor=table
header-includes:
- \usepackage{booktabs}
- \usepackage{tabu}
- \usepackage{threeparttable}
- \usepackage{threeparttablex}
- \usepackage[normalem]{ulem}
---

To use the table xcolor option with beamer on can pass this to the documentclass. In traditional latex
\documentclass[xcolor={table}]{beamer}
For markdown https://bookdown.org/yihui/rmarkdown/pdf-document.html#latex-options suggests that on can use
classoption: xcolor={table}

Related

Removing error of looping through columns in a Latex Tabular Environment

Hi I am using the following code to try and dynamically set the number of columns in a Latex tabular environment:
\documentclass{article}
\usepackage{array}
\newcounter{numcols}
\setcounter{numcols}{4}
\begin{document}
\begin{tabular}{
$\loop
\stepcounter{col}
\ifnum \value{col} < \value{numcols}
c &
\else
c
\fi
\ifnum \value{col} = \value{numcols}
\setcounter{col}{0}
\repeat$
}
\hline
\loop
\stepcounter{col}
\ifnum \value{col} < \value{numcols}
\textbf{Column \thecol} &
\else
\textbf{Column \thecol} \\
\fi
\ifnum \value{col} = \value{numcols}
\setcounter{col}{0}
\repeat
\hline
\loop
\stepcounter{row}
\ifnum \value{row} < 10
\loop
\stepcounter{col}
\ifnum \value{col} < \value{numcols}
Cell \therow,\thecol &
\else
Cell \therow,\thecol \\
\fi
\ifnum \value{col} = \value{numcols}
\setcounter{col}{0}
\repeat
\repeat
\hline
\end{tabular}
\end{document}
However, it throws an error that Illegal pream-token ($): c' used if I remove the $ I receive the same error but it says Illegal pream-token (\loop): c' used.
Any help on solving this error would be much appreciated.
I need to create a table with a dynamic number of columns in Latex

LaTeX with overleaf editor - my text goes off the page - how do I get it to go onto the next line, in line with my other text?

I am new to coding - I am using a template to create my CV with overleaf/LaTeX. There were some default settings but I wanted to create some elements that weren't in the default template. I am trying to add in headings within one of my job experiences but my text goes off the page - how do I get it to go onto the next line and stay in line with my other text?
[Screenshot of line going off the page][1]
%-------------------------
% Resume in Latex
% Author : Jake Gutierrez
% Based off of: https://github.com/sb2nov/resume
% License : MIT
%------------------------
\documentclass[letterpaper,11pt]{article}
\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{contour}
\usepackage{ulem}
\input{glyphtounicode}
%----------FONT OPTIONS----------
% sans-serif
% \usepackage[sfdefault]{FiraSans}
% \usepackage[sfdefault]{roboto}
% \usepackage[sfdefault]{noto-sans}
% \usepackage[default]{sourcesanspro}
% serif
% \usepackage{CormorantGaramond}
% \usepackage{charter}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}
\urlstyle{same}
\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}
% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]
% Ensure that generate pdf is machine readable/ATS parsable
\pdfgentounicode=1
%-------------------------
% Custom commands
\newcommand{\resumeItem}[1]{
\item\small{
{#1 \vspace{-2pt}}
}
}
\newcommand{\resumeSubheading}[4]{
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l#{\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{\small#3} & \textit{\small #4} \\
\end{tabular*}\vspace{-7pt}
}
\newcommand{\resumeSubSubheading}[2]{
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l#{\extracolsep{\fill}}r}
\text{#1} & #2 \\
\end{tabular*}\vspace{-7pt}
}
\newcommand{\resumeProjectHeading}[2]{
\item
\begin{tabular*}{0.97\textwidth}{l#{\extracolsep{\fill}}r}
\small#1 & #2 \\
\end{tabular*}\vspace{-7pt}
}
\renewcommand{\ULdepth}{3pt}
\contourlength{0.8pt}
\newcommand{\myuline}[1]{%
\uline{\phantom{#1}}%
\llap{\contour{white}{#1}}%
}
\newcommand{\resumeSubItem}[1]{\resumeItem{#1}\vspace{-4pt}}
\renewcommand\labelitemii{$\vcenter{\hbox{\tiny$\bullet$}}$}
\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=0.15in, label={}]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}
%-------------------------------------------
%%%%%% RESUME STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%----------HEADING----------
% \begin{tabular*}{\textwidth}{l#{\extracolsep{\fill}}r}
% \textbf{\href{http://sourabhbajaj.com/}{\Large Sourabh Bajaj}} & Email : \href{mailto:sourabh#sourabhbajaj.com}{sourabh#sourabhbajaj.com}\\
% \href{http://sourabhbajaj.com/}{http://www.sourabhbajaj.com} & Mobile : +1-123-456-7890 \\
% \end{tabular*}
\begin{center}
\textbf{\Huge \scshape *******} \\ \vspace{1pt}
\small $|$ \href{}{{}} $|$
\href{}{\underline{LinkedIn}}
\end{center}
%-----------EXPERIENCE-----------
\section{Experience}
\resumeSubHeadingListStart
\resumeSubheading
{}{}
{}{}
\linebreak
\resumeItemListStart
\resumeItem{}
\resumeItem{}
\resumeItem{}
\linebreak
% \resumeItem{\textbf{\underline{{Client: }}}}
% \begin{enumerate}
% \item [-]
% \item[-]
% \end{enumerate}
% \resumeItem{\underline{}}
% \begin{enumerate}
% \item [-]
% \item [-]
% \item[-]
% \end{enumerate}
\begin{itemize}[leftmargin=0in, label={}]
\small{\item{
\text{\uline{}
\item[-]{}
\item[-]{}
\end{enumerate}
}}
\end{itemize}
\begin{itemize}[leftmargin=0in, label={}]
\small{\item{
\text{\uline{{}}} \\
\begin{enumerate}
\item[-]{.}
\end{enumerate}
}}
\end{itemize}
A couple of problems:
the syntax \small{....} is wrong. \small is a switch, which does not take an argument, so it should be {\small ...}. To avoid incorrect baselineskips, I suggest to place this outside of the itemize environment
\text{...} is a math only command. You must not use it outside of math environments.
\item does not take an mandatory argument. Instead of \item{...} it should be \item ....
don't abuse \\ for line breaks (outside of tables etc.).
several missing \end{itemize}
missing \end{document}
%-------------------------
% Resume in Latex
% Author : Jake Gutierrez
% Based off of: https://github.com/sb2nov/resume
% License : MIT
%------------------------
\documentclass[letterpaper,11pt]{article}
\usepackage{latexsym}
\usepackage[empty]{fullpage}
\usepackage{titlesec}
\usepackage{marvosym}
\usepackage[usenames,dvipsnames]{color}
\usepackage{verbatim}
\usepackage{enumitem}
\usepackage[hidelinks]{hyperref}
\usepackage{fancyhdr}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{contour}
\usepackage{ulem}
\input{glyphtounicode}
%----------FONT OPTIONS----------
% sans-serif
% \usepackage[sfdefault]{FiraSans}
% \usepackage[sfdefault]{roboto}
% \usepackage[sfdefault]{noto-sans}
% \usepackage[default]{sourcesanspro}
% serif
% \usepackage{CormorantGaramond}
% \usepackage{charter}
\pagestyle{fancy}
\fancyhf{} % clear all header and footer fields
\fancyfoot{}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
% Adjust margins
\addtolength{\oddsidemargin}{-0.5in}
\addtolength{\evensidemargin}{-0.5in}
\addtolength{\textwidth}{1in}
\addtolength{\topmargin}{-.5in}
\addtolength{\textheight}{1.0in}
\urlstyle{same}
\raggedbottom
\raggedright
\setlength{\tabcolsep}{0in}
% Sections formatting
\titleformat{\section}{
\vspace{-4pt}\scshape\raggedright\large
}{}{0em}{}[\color{black}\titlerule \vspace{-5pt}]
% Ensure that generate pdf is machine readable/ATS parsable
\pdfgentounicode=1
%-------------------------
% Custom commands
\newcommand{\resumeItem}[1]{
\item\small{
{#1 \vspace{-2pt}}
}
}
\newcommand{\resumeSubheading}[4]{
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l#{\extracolsep{\fill}}r}
\textbf{#1} & #2 \\
\textit{\small#3} & \textit{\small #4} \\
\end{tabular*}\vspace{-7pt}
}
\newcommand{\resumeSubSubheading}[2]{
\vspace{-2pt}\item
\begin{tabular*}{0.97\textwidth}[t]{l#{\extracolsep{\fill}}r}
\text{#1} & #2 \\
\end{tabular*}\vspace{-7pt}
}
\newcommand{\resumeProjectHeading}[2]{
\item
\begin{tabular*}{0.97\textwidth}{l#{\extracolsep{\fill}}r}
\small#1 & #2 \\
\end{tabular*}\vspace{-7pt}
}
\renewcommand{\ULdepth}{3pt}
\contourlength{0.8pt}
\newcommand{\myuline}[1]{%
\uline{\phantom{#1}}%
\llap{\contour{white}{#1}}%
}
\newcommand{\resumeSubItem}[1]{\resumeItem{#1}\vspace{-4pt}}
\renewcommand\labelitemii{$\vcenter{\hbox{\tiny$\bullet$}}$}
\newcommand{\resumeSubHeadingListStart}{\begin{itemize}[leftmargin=0.15in, label={}]}
\newcommand{\resumeSubHeadingListEnd}{\end{itemize}}
\newcommand{\resumeItemListStart}{\begin{itemize}}
\newcommand{\resumeItemListEnd}{\end{itemize}\vspace{-5pt}}
%-------------------------------------------
%%%%%% RESUME STARTS HERE %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%----------HEADING----------
% \begin{tabular*}{\textwidth}{l#{\extracolsep{\fill}}r}
% \textbf{\href{http://sourabhbajaj.com/}{\Large Sourabh Bajaj}} & Email : \href{mailto:sourabh#sourabhbajaj.com}{sourabh#sourabhbajaj.com}\\
% \href{http://sourabhbajaj.com/}{http://www.sourabhbajaj.com} & Mobile : +1-123-456-7890 \\
% \end{tabular*}
\begin{center}
\textbf{\Huge \scshape Sophie Clarke} \\ \vspace{1pt}
\small 07920 429 244 $|$ \href{sophieclarke#hotmail.co.uk}{{sophieclarke#hotmail.co.uk}} $|$
\href{https://www.linkedin.com/in/sophie-clarke-5b51aaba/}{\underline{LinkedIn}}
\end{center}
%-----------EXPERIENCE-----------
\section{Experience}
\resumeSubHeadingListStart
\resumeSubheading
{Research Assistant in the Economics of International Trade}{September 2021 -- Present}
{The UK Trade Policy Observatory}{Brighton, UK/ Remote}
\linebreak
\resumeItemListStart
\resumeItem{Assist the UKTPO team of researchers with regard to data and background research and contribute to the production of research outputs for publication.}
\resumeItem{Structure day-to-day research activities; prioritise and meet deadlines across multiple projects.}
\resumeItem{Handle confidential information with diligence and circumspection.}
\linebreak
% \resumeItem{\textbf{\underline{{Client: British Chamber of Commerce}}}}
% \begin{enumerate}
% \item [-] Used MATLAB to support the development of an analytical model to analyse answers to the BCC’s Quarterly Economic Survey using natural language processing, machine learning techniques and sentiment analysis.
% \item[-] Produced a final written report explaining methods, techniques, results and findings.
% \end{enumerate}
% \resumeItem{\underline{Ongoing Research Project: The Consequences of Brexit for the UK}}
% \begin{enumerate}
% \item [-] Textual analysis of EU legal directives and regulations applicable to the single market.
% \item [-]Extensive preparation and use of data.
% \item[-] Written contribution to briefing paper publication.
% \end{enumerate}
{\small
\begin{itemize}[leftmargin=0in, label={}]
\item
\uline{Client: British Chamber of Commerce}
\begin{enumerate}
\item[-] Used MATLAB to support the development of an analytical model to analyse answers to the BCC’s Quarterly Economic Survey using natural language processing, machine learning techniques and sentiment analysis.
\item[-] Produced a final written report explaining methods, techniques, results and findings.
\end{enumerate}
\end{itemize}
}
{\small
\begin{itemize}[leftmargin=0in, label={}]
\item
\uline{Ongoing Research Project: The Impact of the UK Points Based System on European Union Professional Footballer Mobility in England}
\begin{enumerate}
\item[-] Used MATLAB to support the development of a web scraping tool to gather primary data for the project.
\end{enumerate}
\end{itemize}
}
\end{itemize}
\end{itemize}
\end{document}

Missing control sequence inserted. \end{tabulary} error in revtex4-2 template aps

I am writing a paper in APS journal template : revtex4-2, when I import my table I have this error :
Missing control sequence inserted. \end{tabulary}. But this table has no problem in other template for example IEEE. I dont know how fix it. I really appreciate any help.
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
\begin{adjustbox}{max width=8.5 cm}
\begin{tabulary}{\columnwidth}{#{}llr#{}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tabulary}
\end{adjustbox}
\end{table}.
\end{document}
%
% ****** End of file aipsamp.tex ******
I suggest the new and much more flexible tabularray package instead.
Also don't scale content which contains text, this will result in an suboptimal result. If in your real document, you must make the table smaller, use a smaller font size instead of scaling it with adjustbox.
(you should really clean up your preamble and remove duplicates and outdated packages)
\documentclass[aps,pra,twocolumn,floatfix,footinbib,notitlepage,superscriptaddress,groupaddress,showpacs]{revtex4-2}
\usepackage{graphicx,graphics,times,bm,bbm,bbold,amssymb,amsmath,amsfonts,dsfont,hyperref,mathrsfs,color,caption,subcaption,cancel}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{graphicx}% Include figure files
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}
\usepackage{tabularray}
\UseTblrLibrary{booktabs}
\begin{document}
\preprint{AIP/123-QED}
%\title[Sample title]{Sample Title:\\with Forced Linebreak\footnote{Error!}}% Force line breaks with \\
\title[]
\author{}
\affiliation{}
\author{}
\affiliation{}
\email{}
\date{\today}
\begin{abstract}
\end{abstract}
% \keywords{}
% \maketitle
\section{Introduction}\label{sec:introduction}
\section{Theoretical Analysis}
\begin{table}[h!]
\centering
\caption{List of Parameters Values }
\label{table:1}
% \begin{adjustbox}{max width=8.5 cm}
\begin{tblr}{width=0.8\linewidth,colspec={#{}X[l]X[l]X[r]#{}}}
\toprule
\textbf{Parameters} & \textbf{Values} & \textbf{Units}\\
\midrule
$\lambda$ & 1550 & $nm$ \\
\bottomrule
\end{tblr}
% \end{adjustbox}
\end{table}
\end{document}
%
% ****** End of file aipsamp.tex ******

Making a letter head for certificate page of thesis

I am trying to make a letter head to make a certificate to put in a thesis. I have posted the MWE below.
There are 2 issues I need help with
The cell alignment of the letterhead, is not proper. I am not sure how to correct it.
I need the double lines to be in red colour, I wasn't able to get it.
The final output should be something like this image
enter image description here
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\usepackage{xcolor}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\noindent
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\begin{tabular}{c c c}
\multicolumn{1}{r}{{\Large Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.175\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{{\Large University}}\\
%\multicolumn{1}{r}{\Huge{Bangalore}} & \multirow{1}{*}{\includegraphics[width=0.15\linewidth]{BUB_Emblem}} & \multicolumn{1}{l}{\Huge{University}}\\
\large{Dr Vijaykumar H Doddamani} & & \multicolumn{1}{l}{Department of Physics} \\
\multicolumn{1}{r}{M.Sc., M. Phil., PhD} && \multicolumn{1}{l}{Ph. Off: 080-22961471/84} \\
&&\multicolumn{1}{l}{Fax: 080-23219295}\\
\multicolumn{1}{l}{\textbf{\large Professor}} & & \multicolumn{1}{l}{Mobile : 9481300346} \\
\multicolumn{1}{l}{Email: drvkd#gmail.com} & Jnanabharathi Campus & \multicolumn{1}{l}{Mobile : 9448673274} \\
\multicolumn{1}{r}{profvijaykumarhd#bub.ernet.in} & Bengaluru - 560 056 & \multicolumn{1}{l}{WhatsApp :9741716744} \\
%
\end{tabular}
\vskip2mm
\vspace{2mm}
\doublerule[1pt]
\end{document}
With this code, This is the output I am getting.
enter image description here
I have put in the arrows and comments in this imagearrows and comments for width alinment
\documentclass[12 pt,a4 paper]{article}
\usepackage[top=1cm,left=1in,right=1 in,bottom=1in]{geometry}
\usepackage[table]{xcolor}
\usepackage{times}
\usepackage{graphicx}
\usepackage{marvosym}
\usepackage[onehalfspacing]{setspace}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{multirow}
\fancyhf{}
\newcommand{\doublerule}[1][.4pt]{%
\noindent%
\makebox[0pt][l]{\rule[.7ex]{\linewidth}{#1}}%
\rule[.3ex]{\linewidth}{#1}}
\begin{document}
\pagestyle{empty}
\vspace{12 mm}
\centerline{%
\makebox[\paperwidth]{%
\begin{tabular}{#{\hspace{.08\paperwidth}} p{.32\paperwidth} p{.2\paperwidth} p{.32\paperwidth} #{\hspace{.08\paperwidth}} }
\multicolumn{1}{#{}r#{}}{\Large Bangalore} & \centering\multirow{1}{*}{\includegraphics[width=.9\linewidth]{example-image-duck}} & \Large University\\
\multicolumn{1}{#{}r#{}}{\large Dr Vijaykumar H Doddamani} & & Department of Physics\\
\multicolumn{1}{#{}r#{}}{M.Sc., M. Phil., PhD} && Ph. Off: 080-22961471/84 \\
&&Fax: 080-23219295\\
\textbf{\large Professor} & & Mobile : 9481300346 \\
Email: drvkd#gmail.com & \centering Jnanabharathi Campus & Mobile : 9448673274 \\
\hphantom{Email:} profvijaykumarhd#bub.ernet.in & \centering Bengaluru - 560 056 & WhatsApp :9741716744 \\[2mm]
\arrayrulecolor{red}\hline\hline
\end{tabular}%
}}
\end{document}

How do i create a table of contents per infront of every chapter that lists the contents of that chapter?

I am working on a document with multiple works in it and need to be able to create a new tableofcontents per work. How do I achieve that? To be clear, the diffrent works are sections, so I need a tableofcontents that shoes all sub- and subsubsections etc of the current section.
Here is an example
\documentclass[paper=170mm:240mm,BCOR=5mm,DIV=calc,10pt,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[hyphens]{url}
\usepackage{blindtext}
\usepackage[onehalfspacing]{setspace}
\usepackage{pdfpages}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{backgrounds,calc}
\setquotestyle[guillemets]{german}
\usepackage[symbol,hang]{footmisc}
%package für Abkürzungsverzeichnis
\usepackage[]{acronym}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\headmark}
\automark[subsection]{section}
\ofoot[\pagemark]{\pagemark}
\usepackage[fleqn]{amsmath}
\usepackage{xcolor}
\usepackage{imakeidx}
\makeindex[program=makeindex,options=-s MyIndex,columns=2,title=Sachregister,intoc]
% Use package for title formatting
\usepackage{titlesec}
\usepackage{float}
% Make title page
%Hier Set und Def von Sachen-----------------------------------------
% Strich bei Seitenzahlen:------------------
\rofoot*{%
\makebox[0pt][l]{%
\hspace{\marginparsep}%
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\enskip
\pagemark
}%
}
\lefoot*{%
\makebox[0pt][r]{%
\pagemark
\enskip
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\hspace{\marginparsep}%
}%
}
\addtokomafont{pagehead}{\upshape}
%---------------------------------------------
\title{a}
\author{b }
\date{April 2021}
%Dokument-----------------------------------------------------------
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\Blinddocument
\end{document}
This is the format I'm using
One possibility using the etoc package:
\documentclass[paper=170mm:240mm,BCOR=5mm,DIV=calc,10pt,headsepline]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[ngerman]{babel}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage[babel, german=quotes]{csquotes}
\usepackage[hyphens]{url}
\usepackage{blindtext}
\usepackage[onehalfspacing]{setspace}
\usepackage{pdfpages}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{backgrounds,calc}
\setquotestyle[guillemets]{german}
\usepackage[symbol,hang]{footmisc}
%package für Abkürzungsverzeichnis
\usepackage[]{acronym}
\usepackage{scrlayer-scrpage}
\pagestyle{scrheadings}
\clearpairofpagestyles
\ohead{\headmark}
\automark[subsection]{section}
\ofoot[\pagemark]{\pagemark}
\usepackage[fleqn]{amsmath}
\usepackage{xcolor}
\usepackage{imakeidx}
\makeindex[program=makeindex,options=-s MyIndex,columns=2,title=Sachregister,intoc]
% Use package for title formatting
%\usepackage{titlesec}
\usepackage{float}
% Make title page
%Hier Set und Def von Sachen-----------------------------------------
% Strich bei Seitenzahlen:------------------
\rofoot*{%
\makebox[0pt][l]{%
\hspace{\marginparsep}%
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\enskip
\pagemark
}%
}
\lefoot*{%
\makebox[0pt][r]{%
\pagemark
\enskip
\raisebox{0pt}[\ht\strutbox][\dp\strutbox]{%
\rule[-\dp\strutbox]{1pt}{2\baselineskip}%
}%
\hspace{\marginparsep}%
}%
}
\addtokomafont{pagehead}{\upshape}
%---------------------------------------------
\title{a}
\author{b }
\date{April 2021}
\usepackage{etoc}
\etocsettocstyle{}{}%
%Dokument-----------------------------------------------------------
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\chapter{First Chapter}
\localtableofcontents
\section{title}
\section{title}
\blindtext
\end{document}

Resources