\documentclass[unicode,11pt,titlepage]{ltjsreport}
\usepackage[no-math,deluxe,expert,haranoaji]{luatexja-preset}
\pdfvariable imageresolution 150
\usepackage[margin=20truemm]{geometry}
\setmainfont{TeX Gyre Schola}
\setsansfont{TeX Gyre Heros}
\setmonofont{TeX Gyre Cursor}
\setmainjfont{HaranoAjiMincho-Regular}
\setsansjfont{HaranoAjiGothic-Regular}
\setmonojfont{HaranoAjiGothic-Light}
\usepackage{fancyhdr}
\usepackage{nameref}
\usepackage[unicode,bookmarksnumbered]{hyperref}
\hypersetup{
  colorlinks=true,
  citecolor=black,
  linkcolor=blue,
  filecolor=black,
  urlcolor=black,
}
\usepackage{listings}
\usepackage{ulem}
\usepackage{fancybox}
\usepackage{enumitem,amssymb}
\usepackage{float}
\usepackage{graphicx}
\usepackage{caption, capt-of}
\usepackage{tabularray}[=v2021]
\UseTblrLibrary{varwidth}
\DefTblrTemplate{capcont}{default}{}
\SetTblrTemplate{capcont}{default}
\usepackage{multirow}
\usepackage{varwidth}
\usepackage{cellspace}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\usepackage{colortbl}
\newcolumntype{L}{Sl}
\newcolumntype{C}{Sc}
\newcolumntype{R}{Sr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}
\usepackage{xcolor, soul}
%%%%
\usepackage{tikz}
\usetikzlibrary{calc}
\makeatletter
\newcommand{\currentsidemargin}{%
  \ifodd\value{page}%
    \oddsidemargin%
  \else%
    \evensidemargin%
  \fi%
}
\newlength{\whatsleft}
\newcommand{\measureremainder}[1]{%
\begin{tikzpicture}[overlay,remember picture]
    % Helper nodes
    \path (current page.north west) ++(\hoffset, -\voffset)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\paperwidth, minimum height=\paperheight]
        (pagearea) {};
    \path (pagearea.north west) ++(1in+\currentsidemargin,-1in-\topmargin-\headheight-\headsep)
        node[anchor=north west, shape=rectangle, inner sep=0, minimum width=\textwidth, minimum height=\textheight]
        (textarea) {};
        % Measure distance to right text border
    \path let \p0 = (0,0), \p1 = (textarea.east) in
        [/utils/exec={\pgfmathsetlength#1{\x1-\x0}\global#1=#1}];
\end{tikzpicture}%
}
\newcommand{\tgthrowcolor}{\rowcolor[rgb]{0.9, 0.9, 0.9}}
\newcommand{\tgtdrowcolor}{}
\makeatother
%%%%
\makeatletter
\renewcommand{\chapter}{
  \if@openleft\cleardoublepage\else
  \if@openright\cleardoublepage\else\clearpage\fi\fi
  \global\@topnum\z@
  \if@english \@afterindentfalse \else \@afterindenttrue \fi
  \secdef
  {\@omit@numberfalse\@chapter}
  {\@omit@numbertrue\@schapter}}
\def\@makechapterhead#1{%
  \vspace*{1\Cvs}
  {\parindent \z@ \raggedright \normalfont
  \ifnum \c@secnumdepth >\m@ne
  \huge\headfont \@chapapp\thechapter\@chappos
  \fi
  \quad
  \interlinepenalty\@M
  \huge \headfont #1\par\nobreak
  \vskip 1\Cvs}}
\renewcommand{\paragraph}{\@startsection{paragraph}{4}{0ex}%
   {-3.25ex plus -1ex minus -0.2ex}%
   {1.5ex plus 0.2ex}%
   {\normalfont\normalsize\bfseries}}
\setlength{\parindent}{0pt}
\setlength{\parskip}{0.5em}
\setlength{\floatsep}{1em}
\renewcommand{\tableofcontents}{%
  \vspace{-20pt}
  \settowidth\jsc@tocl@width{\headfont\presectionname\postsectionname}%
  \settowidth\@tempdima{\headfont\appendixname}%
  \ifdim\jsc@tocl@width<\@tempdima\relax\setlength\jsc@tocl@width{\@tempdima}\fi
  {\hypersetup{linkcolor=black}
  \@starttoc{toc}%
  }
}
\renewenvironment{thebibliography}[1]
{
   \list{\@biblabel{\@arabic\c@enumiv}}%
        {\settowidth\labelwidth{\@biblabel{#1}}%
         \leftmargin\labelwidth
         \advance\leftmargin\labelsep
         \@openbib@code
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
   \sloppy
   \clubpenalty4000
   \@clubpenalty\clubpenalty
   \widowpenalty4000%
   \sfcode`\.\@m}
  {\def\@noitemerr
    {\@latex@warning{Empty `thebibliography' environment}}%
   \endlist}
\let\@openbib@code\@empty
\makeatother
\newcommand{\tgincludegraphics}[2][100bp]{%
  \measureremainder{\whatsleft}
  % \ifdim #1<\linewidth
  \ifdim #1<\whatsleft
    \includegraphics[keepaspectratio,width=#1]{#2}
  \else{
  \ifdim 0bp<\whatsleft
    % \includegraphics[keepaspectratio,width=\linewidth]{#2}
    \includegraphics[keepaspectratio,width=\whatsleft]{#2}
  \else{
    \includegraphics[keepaspectratio,width=-\whatsleft]{#2}
  }\fi
  }\fi
}
\newcommand{\tgcaption}[1][l]{%
  \captionsetup{%
    % font=small,
    % labelfont=bf,
    singlelinecheck=false,
    % tableposition=top,
    justification=#1,
  }
}
\newenvironment{tgchecklist}{
  \begin{itemize}
}{
  \end{itemize}
}
\newcommand{\tgcheck}[1][dis]{
  \tgincludegraphics[10bp]{${doc.template_dir}/common/check_#1.pdf}
}
\newcommand{\colortext}[3][RGB]{%
  \begingroup
  \definecolor{hlcolor}{#1}{#2}\sethlcolor{hlcolor}%
  \hl{#3}%
  \endgroup
}
\newcommand{\desctitle}[1]{\textbf{#1}}
\newcommand{\varbox}[1]{\colortext[gray]{0.95}{\small \texttt{\itshape{#1}}}}
\newcommand{\codebox}[1]{\colortext[gray]{0.95}{\small \texttt{#1}}}
\newcommand{\kbdbox}[1]{\ovalbox{\footnotesize \texttt{#1}}}
\newcommand{\btnbox}[1]{\ovalbox{\footnotesize \textsf{#1}}}
\newcommand{\menubox}[1]{\colortext[gray]{0.9}{\footnotesize \textsf{#1}}}
\lstdefinestyle{common}{
  numbers=none,
  basicstyle={\small \ttfamily},
  stringstyle={\small \ttfamily},
  frame=single,
  breaklines=true,
  showstringspaces=false,
  backgroundcolor=\color[gray]{0.95},
  commentstyle={\color{teal}},
  stringstyle={\color{violet}},
  keywordstyle={\color{blue}},
  moredelim=**[is][\itshape]{<?tg:I?>}{<?tg:I?>},
  moredelim=**[is][\bfseries]{<?tg:S?>}{<?tg:S?>},
  moredelim=**[is][\underbar]{<?tg:U?>}{<?tg:U?>},
  moredelim=**[is][\sout]{<?tg:SO?>}{<?tg:SO?>},
  moredelim=**[is][\itshape]{<?tg:VAR?>}{<?tg:VAR?>},
}
\lstdefinestyle{bash}{language=bash, style=common}
\lstdefinestyle{c}{language=C, style=common}
\lstdefinestyle{c++}{language=C++, style=common}
\lstdefinestyle{csh}{language=csh, style=common}
\lstdefinestyle{java}{language=Java, style=common}
\lstdefinestyle{make}{language=make, style=common}
\lstdefinestyle{perl}{language=Perl, style=common}
\lstdefinestyle{php}{language=PHP, style=common}
\lstdefinestyle{python}{language=Python, style=common}
\lstdefinestyle{ruby}{language=Ruby, style=common}
\lstdefinestyle{sh}{language=sh, style=common}
\lstdefinestyle{verilog}{language=Verilog, style=common}
\lstdefinestyle{xml}{language=XML, style=common}
\lstset{style=common}

\title{${doc.title}}
\author{${doc.author}}
\date{${doc.date}}
\fancypagestyle{fancy}{
\fancyhead[LE,LO]{${doc.title}}
\fancyhead[RE,RO]{!confidencial!}
\fancyfoot[CE,CO]{\thepage}
}
\fancypagestyle{beforecontents}{
\fancyhead[LE,LO]{${doc.title}}
\fancyhead[RE,RO]{!confidencial!}
\fancyfoot[CE,CO]{}
}
\pagestyle{fancy}

\begin{document}
\maketitle
${doc.data}
\end{document}
