38k views

### What is the use of percent signs (%) at the end of lines? (Why is my macro creating extra space?)

I see that the code in many packages and examples contains percent signs % at the end of (many) lines. What are they used for? Do they affect the parsing of those lines?
• 9,874
8k views

### How to automatically add text immediately after \begin{document}

I attempted to redefine the document environment as follows, but get a complaint that: LaTeX Error: \begin{MYdocument} on input line 13 ended by \end{document}. \documentclass[12pt]{article} \...
• 217k
54k views

### Control spacing around table caption

I want to put several tables in the same table float like this: \documentclass[a4paper, 12pt]{article} \usepackage[T1]{fontenc} \usepackage{subfig} \begin{document} \begin{table} \caption{Internal ...
• 413
3k views

### What is the plain TeX equivalent of \settowidth?

The \settowidth command, which sets a width equal to the width of some text, is described at Get width of a given text as length and How to set the width of the label of a description to the width of ...
• 12.8k
3k views

### minted list of listings and TOC conflict

I am using minted for source code highlighting. I want a List of Listings, and I want the List of Listings to itself have an entry in the main Table of Contents. I thought I could do this with ...
• 186
4k views

### mixing minted with lstlisting

I have a List of Listings that looks like this: The first listing, which is correct, uses lstlisting. 3.1 is the correct chapter. The second listing uses minted. Somehow it shows 1 as chapter, which ...
• 183
782 views

### Save and restore the makeatletter/makeatother state

When posting snippets of latex code that define or modify commands containing @, one commonly includes the \makeatletter...\makeatother wrapper that's necessary if pasting the snippet into an ordinary ...
• 1,485
1 vote
4k views

### Customizing the list of listings from minted

This question is in regards to customizing the format of the list of listings produced with the minted package. In particular, I want to replicate the formatting produced via the tocloft for Figures: ...
• 13
2k views

### Adjust vertical spacing between caption and listing in KOMA (scrartcl)

In the standard article class the distance between caption and the listing below it is fine. But when using KOMA-Script's documentclass scrartcl the vertical space is too big (see the image below). I'...
• 613
181 views

### Why the empty space size is increasing each call to my calculate listing header command?

I learned how to create a list of codes on my thesis on the question Setting Entries of List of Listings in LaTeX. Package Listings and I put that command on another file with english tiles as \...
• 4,455
1 vote
131 views

### Latex keeps showing minted environment as Figures instead of Listening

I am trying to use "Figure" as name of listings in listoflistings with minted and newfloat fix, but it does not work. Latex keeps showing minted environment as Figures instead of Listening: ...
• 4,455
80 views

### How to replace a command argument as #2 with something else?

I am trying to patch this macro: \xshowcmd\addcontentsline > \addcontentsline=macro: #1#2#3->\begingroup \let \label \@gobble \ifx \@currentHref \@empty \Hy@Warning {No destination for ...
• 4,455