Include YAML and Bicep language into Latex/Overleaf - latex

I'd like to use yaml and Bicep as my languages and integrate it into my codeblock.
I have made a general setting for my listings as followed.
\usepackage{listings}
\usepackage{xcolor}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\small\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
frame=single,
framexleftmargin=5mm,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
For my code I am using YAML and Bicep language, however, Latex/Overleaf does not have these languages specified and I receive an error when defining the following.
\begin{lstlisting}[language=yaml, caption= caption here]
# Specifies when to run the pipeline
trigger:
- master
\end{lstlisting}
Error message
Package Listings Error: Couldn't load requested language.
Is there an alternative how I can include yaml and Bicep as languages, or do I need to integrate the manually?
Thank you very much in advance.

Related

Latex Commands with URL

I am having trouble adding a URL to the Linkedin command. I want it to essentially print the Linkedin logo, text that I want to be explicitly seen, and a URL that the user will be redirected to upon clicking it. Below is the current .cls file.
.cls file:
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\usepackage{hyperref}
\newcommand{\linkedin}[1]{\printinfo{\linkedinsymbol}{#1}}
I tried turning the last line into the following:
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}}{\url{#2}}
However, upon doing so, I get the following errors:
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
! Undefined control sequence.
\hyper#linkurl ...tionraw >>}\relax \Hy#colorlink
\#urlcolor #1\Hy#xspace#en...
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
! Undefined control sequence.
\close#pdflink ->\Hy#endcolorlink
\Hy#VerboseLinkStop \pdfendlink
l.91 ...{\printinfo{\linkedinsymbol}{#1}}{\url{#2}
}
?
Minimum Reproducible Example:
main.tex:
\PassOptionsToPackage{dvipsnames}{xcolor}
\documentclass[10pt,letterpaper]{altacv}
\geometry{left=1cm,right=9cm,marginparwidth=6.8cm,marginparsep=1.2cm,top=1.25cm,bottom=1.25cm,footskip=2\baselineskip}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[default]{lato}
\usepackage[hidelinks]{hyperref}
\begin{document}
\linkedin{linkedin.com/in/varunjain-me}{www.linkedin.com/in/varunjain-me}
\end{document}
.cls file:
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\#ifl#t#r\fmtversion{2018/04/01}{\UseRawInputEncoding}{}
\ProvidesClass{altacv}[2018/07/27 AltaCV v1.1.4, yet another alternative class for a résumé/curriculum vitae.]
\newif\if#academicons
\DeclareOption{academicons}{\#academiconstrue}
\newif\if#normalphoto
\DeclareOption{normalphoto}{\#normalphototrue}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}}
\ProcessOptions\relax
\LoadClass{extarticle}
\RequirePackage[margin=2cm]{geometry}
\RequirePackage{fontawesome}
\if#academicons
\ExplSyntaxOn
\msg_redirect_name:nnn { fontspec } { font-not-found } { none }
\ExplSyntaxOff
\RequirePackage{academicons}
\newfontfamily{\AI}{academicons.ttf}
\fi
\RequirePackage{xcolor}
\colorlet{accent}{blue!70!black}
\colorlet{heading}{black}
\colorlet{emphasis}{black}
\colorlet{body}{black!80!white}
\newcommand{\itemmarker}{{\small\textbullet}}
\newcommand{\ratingmarker}{\faCircle}
\RequirePackage{tikz}
\usetikzlibrary{arrows}
\RequirePackage[skins]{tcolorbox}
\RequirePackage{enumitem}
\setlist{leftmargin=*,labelsep=0.5em,nosep,itemsep=0.25\baselineskip,after=\vskip0.25\baselineskip}
\setlist[itemize]{label=\itemmarker}
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{dashrule}
\RequirePackage{multirow,tabularx}
\RequirePackage{changepage}
\setlength{\parindent}{0pt}
\newcommand{\divider}{\textcolor{body!30}{\hdashrule{\linewidth}{0.6pt}{0.5ex}}\medskip}
\newenvironment{fullwidth}{%
\begin{adjustwidth}{}{\dimexpr-\marginparwidth-\marginparsep\relax}}
{\end{adjustwidth}}
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}}{\url{#2}}
Here is the code that ended up working for my scenario:
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\usepackage{hyperref}
\colorlet{accent}{blue!70!black}
\begin{document}
\newcommand{\linkedinsymbol}{\faLinkedin}
% \newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\weblinks}[3]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}{\href{#2}{#3}}\hspace{2em}}}
% \newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}{\url{#2}}}
\newcommand{\linkedin}[2]{\weblinks{\linkedinsymbol}{#1}{#2}}
\linkedin{http://linkedin.com/in/varunjain-me}{linkedin.com/in/varunjain}
\end{document}
This minimal example works for me:
\documentclass{article}
\usepackage{fontawesome}
\usepackage{xcolor}
\usepackage{hyperref}
\colorlet{accent}{blue!70!black}
\begin{document}
\newcommand{\linkedinsymbol}{\faLinkedin}
\newcommand{\printinfo}[2]{\mbox{\textcolor{accent}{\normalfont #1}\hspace{0.5em}#2\hspace{2em}}}
\newcommand{\linkedin}[2]{\printinfo{\linkedinsymbol}{#1}{\url{#2}}}
\linkedin{linkedin.com/in/varunjain-me}{www.linkedin.com/in/varunjain-me}
\end{document}
At least it produces some output... I don't know what exactly you expect, but you can probably take it from here.

Doxygen LaTeX output paragraph indentation

I have an SW manual that I'm documenting with Doxygen+Markdown, the output being a PDF file. The default Doxygen LaTeX header uses \setlength{\parindent}{0cm}. I tried to change that to \setlength{\parindent}{20pt}, but the output PDF still doesn't have indented paragraphs. I was wondering if I need to change the doxyparagraph style.
Thanks!
EDIT:
I'm using text and other content from Markdown files. Looking at a TeX file from one of these MD files, I can't see anything special(environment, etc) aboout how thery're being defined. In a MD file I have:
### Boot Initialization {#prom_rom_boot_initialization}
The boot ROM performs basic system initialization required for booting the
system. The system initialization consists of the following:
This generates:
\hypertarget{program_rom_chapter_prom_rom_boot_initialization}{}\doxysubsubsection{Boot Initialization}\label{program_rom_chapter_prom_rom_cfx_boot_initialization}
The boot R\+OM performs basic system initialization required for booting the system. The system initialization consists of the following\+:
The doxysubsection is defined in the default Doxygen LaTeX style as:
\newcommand\doxysubsection{\#startsection{subsection}{2}{\z#}%
{-3.25ex\#plus -1ex \#minus -.2ex}%
{1.5ex \#plus .2ex}%
{\raggedright\normalfont\large\bfseries}}
So I tried to do the following in my header:
\renewcommand{\paragraph}{%
\#startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{%
\setlength{\parindent}{20pt}%
\normalfont\normalsize\bfseries\SS#parafont%
}%
}
\renewcommand{\subparagraph}{%
\#startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{%
\setlength{\parindent}{20pt}%
\normalfont\normalsize\bfseries\SS#subparafont%
}%
}
\makeatother
That didn't work.
So I tried setting parindent in my document:
\documentclass[parindent=20pt,10pt,twoside,openany]{book}
And use the ragged2e package. I've added
\usepackage[document]{ragged2e}
\setlength{\RaggedRightParindent}{\parindent}
To my header. And set \parindent=20pt instead of \setlength{\parindent}{0cm}.
I still don't get indented paragraphs.

subsection command not working in elsevier LaTeX template

I am working on Elsevier template with a single column format, I am facing an issue with subsections command not working as they are displayed like a normal section with wrong numbering, for example
\documentclass[a4paper,fleqn]{cas-sc}
\begin{document}
\section{A}
\subsection{AA}
\subsubsection{BB}
\end{document}
Can anyone help me on how to fix this issue?
You're using it properly. This must be an issue with your class file (cas-sc) that you are using.
I'm not sure if this is by design (which would be a very odd behaviour), but this behaviour is caused by some redefinition in the class file. To workaround this problem one could fix these redefinitions and use
\documentclass[a4paper,fleqn]{cas-sc}
\makeatletter
\renewcommand\subsection{\#startsection{subsection}{2}{\z#}%
{10pt \#plus 3\p# \#minus 2\p#}%
{.1\p#}%
{%\let\#hangfrom\relax
\ssectionfont\raggedright }}
\renewcommand\subsubsection{\#startsection{subsubsection}{3}{\z#}%
{10pt \#plus 1\p# \#minus .3\p#}%
{.1\p#}%
{%\let\#hangfrom\relax
\sssectionfont\raggedright}}
\makeatother
\begin{document}
\section{A}
\subsection{AA}
\subsubsection{BB}
\end{document}
(don't do this if you intend to submit the document to the journal)

How can I tweak the numbering inside the appendices environment?

I have the following structure in my Latex book:
1) main file
...
\include{chapter1}
\include{chapter2}
\include{chapter3}
...
2) chapterN.tex
\input{file1}
\input{file2}
\input{file3}
\begin{appendices}
\input{appendix_1_chapterN}
\input{appendix_2_chapterN}
\end{appendices}
The result is that the appendixes at the end of chapter 1 (for instance) is named ".1" and ".2", when I would like them to be name "1.A" and "1.B".
Any help is appreciated.
The answer to this is covered in the documentation to the appendix package, which is required for the appendices environment that you are using: ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/appendix/appendix.pdf
The answer to your question is that you are using the appendices environment for section appendices, where it is designed for chapter appendices. To achieve your goal of section appendices, use the subappendices environment instead as shown below:
\documentclass{book}
\usepackage{appendix}
\begin{document}
\chapter{Intro}
\section{Intro Sec}
\begin{subappendices}
\section{Appendix Sec}
\end{subappendices}
Some Text
\chapter{Conclusion}
Some Text
\end{document}

Listings adds whitespaces, how to remove it?

Hey guys,
when using listings to present code in my PDF, it adds whitespaces after some characters.
This is how it looks in the pdf (I'm not allowed to post images because of reputation, 'hence add ".png" to the url, sorry).
I'm using the following code to add the listings.
\newcommand{\lstchange}[2]{
\lstset{breaklines=true,
frame=single,
captionpos=b,
basicstyle={\ttfamily\footnotesize},
showspaces=false,
showstringspaces=false,
showtabs=false,
numberstyle={\ttfamily\footnotesize},
keywordstyle={\bfseries\color{blue}},
stringstyle=\color{darkorange}\ttfamily,
commentstyle=\color{OliveGreen},
language=#1,
morekeywords={#2} }
}
% ...
\lstchange{bash}{svn , cd, gnome-open}
\begin{lstlisting}[caption=someCaption, label=someLabel]
#!/bin/bash
svn checkout http://opendecisionrepository.googlecode.com/svn/trunk/sources/web-interface/src/main/webapp odr-appetizer-2 -r 621
cd odr-appetizer-2
#open drawing.xhtml
gnome-open drawing.xhtml
\end{lstlisting}
Does anyone of you have an idea why this happens? Even if I use the standard example from the latex wikibook this happens.
Maybe this is also important for you, the config file:
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[left=2.5cm, right=2.5cm, top=2.5cm, bottom=3cm, a4paper]{geometry}
\usepackage[pdftex]{graphics}
\usepackage{fancyhdr}
\usepackage{%
array,
booktabs,
dcolumn,
rotating,
shortvrb,
tabularx,
units,
url,
xcolor,
lastpage,
longtable,
lscape,
multirow,
amssymb,
amsmath,
float,
chngpage,
colortbl,
helvet,
listings
}
Thanks in advance!
Cheers,
Ben
Cannot reproduce this here (with \documentclass{article}), it looks fine. I only had to comment out "OliveGreen" because it was unknown.

Resources