Highlighting a Chunk of Code within a lstlisting

I have a bunch of code in a lstlisting environment. How can I highlight (color background) just a particular chunk of code within the environment?

LaTeX, a0poster,tikz and multicols

I'm using the multicol package inside an a0poster document class. I am trying out a 3 column layout for a portrait poster. I have a large tikz drawing that I want to put inside a figure...

How to make chapter*, section* and subsection* appear in the table of contents

I need to produce a PDF document in which I need some "chapters" (along with its sections and subsections) to be non-numbered but still included in the ToC. This is for my master thesis. I'm using...

Converting PDF to CMYK (with identify recognizing CMYK)

I am having much trouble to get ImageMagick's identify to, well, identify a PDF as CMYK. Essentially, let's say I'm building this file, test.tex, with...

XML to TeX or how to get a beautiful PDF from XHTML-like source

Superficially, an easy question: how do I get a great-looking PDF from my XML document? Actually, my input is a subset of XHTML with a few custom attributes added (to save some information on...

C++ program cannot find latex command with system() function call

I am writing a C++ program which has to automatically generate some data to be used by students in an integrated exercise. I have already exported this data to .tex files and would also like the...

rmarkdown: pandoc: pdflatex not found

When I use the render{rmarkdown} to produce pdf file from .Rmd file on my Mac, an error message says pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document...

Error when generating R package manual

I having the following issue when trying to check a package using the command line. First I get this very general error message: * checking PDF version of manual ... WARNING LaTeX errors when...

Convert a iPython Notebook file, containing Latex, Markdown Texts and Graphs, to PDF

I am converting a ipython notebook file (mynotebook.ipynb) to a PDF file for model documentation. It contains some LaTex-format mathematical equations, markdown texts, codes and graphs. For...

Highlighting text affecting page numbers in Latex

So I am writing an assignment in Latex. As part of this assignment, I have to highlight various pieces of writing in different colours according to theme. After researching, I have used the soul...

LaTeX Error: `xcolor.sty' not found when including tikz

my preamble is currently looking like...

How to write your own LaTeX preamble in Matplotlib?

I'm trying to create a figure in matplotlib to insert in my LaTeX document, and I need the bold 'i' and 'j' symbols without their dots and a hat instead. I've been using the code...

How to render LaTeX correctly within function help pane in Rstudio?

Mathematical equations written in LaTeX are often presented within the function documentation accessed in R via help() or ? and presented in the help pane in Rstudio. They do not render correctly...

How to install only cmap.sty required packages in my machine

I'm trying to convert a tex document to pdf. But when I did pdflatex doc.tex, I got This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex) restricted...

! Illegal unit of measure (pt inserted) PDF Knit Error

I'm trying to knit a report as a PDF in RStudio. The code I have so far works fine (I've been testing it chunk by chunk) until it gets to the below chunk: ##...

Error generating PDF document with Rmarkdown when output_dir contains spaces

Here is a minimal working example called mwe.Rmd: --- output: pdf_document: latex_engine: xelatex keep_tex: TRUE ## header-includes: ## -...

Remove PDF metadata (removing complete PDF metadata )

I want to remove metadata from PDF files. I have already tried to use "exiftool", "pdftk" and "qpdf" to remove the metadata (method proposed - https://gist.github.com/hubgit/6078384 ). These tools...

SPHINX - numref works for HTML but not for LaTex

I am working on a Sphinx project for software documentation, which includes a lot of figures. I use 'numref' for referring to the pictures. In HTML it works fine. In LaTex I get Fig. ?? There are...

How to fix LaTeX standalone.cls not found problem on Heroku?

I am trying to make a discord bot on Heroku. I wanted to use sympy preview feature on my bot. I used git://github.com/holiture/heroku-buildpack-tex.git build pack. My code is: x =...

Citation not working in latex using natbib package

I am new to latex. I have been trying to add citations in a document but its not working. I have used the package natbib and the command \citet{DAVANZO201573} in the 2nd line of the first...

Latex failed to compile Markdown PDF from R shiny

Sorry if I'm missing some information here. I'm trying to render a PDF from R shiny and R Markdown, but keep getting this error. The whole thing does run in HTML, but the idea is that I can...

PDFPages package will not load in PDFLatex

I'm trying to include a PDF using \usepackage{pdfpages} but the package will not load. I'm getting the following error: LaTeX Warning: You have requested release `2020-10-01' of LaTeX, ...

In a shiny app is there a reason downloadHandler() can't render a pdf from rmarkdown::render()?

I have a complicated shinny app, that works perfectly, with the exception of a download button intended to render a pdf from rmarkdown to generate a downloadable report. In a nut shell...

Error running pdflatex from RStudio - can't compile pdfs since updating

I am trying to use knitr in RStudio to make a pdf (using pdflatex/MiKTeX). I'm on a Windows 10 machine. This was working fine until I updated R, RStudio, and MikTeX this month (Feb 2021). I'm...

Unable to compile a Rmarkdown file on Arch Linux

I'm having a problem compiling a simple Rmarkdown file, and I'm clueless about the solutions. Here is the problem: Document I want to compile It's a simple document without R code, just text. In...

Adding a letterhead to an RMarkdown PDF

I'm trying to replicate a report using RMarkdown/LaTeX. Is it possible to add a letterhead to the top of a page in a similar way to the image I've attached? Hoping to find a solution where I can...

R: Knitting error rticles \vadjust in vertical mode

I tried to use the package rticles within a Rmd file, in order to generate journal publications. When trying to knit the template as it is, I get following error his is pdfTeX, Version...

How to avoid "! LaTeX Error: Environment axis undefined" when using include_tikz with pgfplots?

I have successfully included in an R/exams .Rmd file several graphics made in TikZ. The same does not happen when I try to include a plot under pgfplots using include_tikz(). Whenever \begin...

Add new line to table cell in rmarkdown kable. Linebreak \n not working for latex output

I am creating a longtable in rmarkdown, which is text heavy. I'm setting the column width using column_spec to space text over multiple lines, but would like to insert manual line breaks to...

! LaTeX3 Error: Mismatched LaTeX support files detected. (LaTeX3) Loading 'expl3.sty' aborted! (LaTeX3)

I can't compile my R Markdown files with knitr. The error message I get is the following: ! LaTeX3 Error: Mismatched LaTeX support files detected. (LaTeX3) Loading 'expl3.sty'...