Linked Questions

373 votes
4 answers
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?
47 votes
2 answers
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} \...
31 votes
3 answers
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
16 votes
2 answers
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
4 votes
1 answer
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
7 votes
1 answer
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 ...
4 votes
2 answers
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
1 answer
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
6 votes
1 answer
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
5 votes
1 answer
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
1 answer
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
0 votes
1 answer
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
0 votes
1 answer
69 views

\xpatch fails if \PassOptionsToPackage{french}{babel} is used

Everything works fine if I do not use \PassOptionsToPackage{french}{babel}. My document class abntex2 already loads babel, then, to load the french language I need to use \PassOptionsToPackage{french}...
  • 4,455