Questions tagged [sourcecode]

{sourcecode} is for questions regarding the source code for (La)TeX documents, including syntax questions, style decisions, package sources, etc. For questions about printing code in LaTeX documents, use the {code} tag.

is for questions regarding the source code for (La)TeX documents, including syntax questions, style decisions, package sources, etc. For questions about printing code in LaTeX documents, use the tag.

At CTAN, the Comprehensive TeX Archive Network, one can view the sources and documentation for most LaTeX packages, and using texdef (as described here), one can view the definition of a given TeX or LaTeX command.

Frequently Asked Questions

  1. Why does example code often use % at the end of lines?
  2. How can I see the "implementation" of a LaTeX command?
  3. Why doesn't TeXStudio recognize some commands?
353 questions
25
votes
2 answers

Pretty printing of LaTeX code

In many MWE here on TeX.SE the LaTeX code is written without explanatory comments and as compact as possible. An Example: \documentclass[ngerman,fontsize=12pt,pagesize]{scrreprt} \usepackage{lmodern} \usepackage[T1]{fontenc}…
Mensch
  • 65,388
6
votes
2 answers

How to make a new line in the source file but not the output

I want to adhere to the traditional '80 character' line length limit in my .tex source file. How do I do a new line in the source but not in the document output?
Todd Davies
  • 1,389
6
votes
1 answer

Reference line in document's own source code

I am commenting on a LaTeX document (with todonotes), and I would like to put a reference to a line in the source code, writing e.g.: See the code around line 123 of foo.tex to please fix this ugly equation. foo.tex itself is included into a…
mSSM
  • 3,152
6
votes
4 answers

Does the tab key do anything?

As far as I can see, the tab key doesn't do anything and can therefore be used safely without altering the output. I googled it but I haven't found anything. It's usually all about the tab command.
MaestroGlanz
  • 2,348
4
votes
1 answer

Where one can find an old version of `table` environment

This question is a result of an answer to Table captions do not appear on top in IEEETran class As far as I remember, a long time ago the caption for a table was always in a proper position. It was independent on the relative position of \caption to…
3
votes
0 answers

How to make code (python, java, scala) looks as beautiful as algorithms?

I know there is a very good package for listing code (listing package) but codes are ugly. I know there are some good package for algorithms (algorithmics, algorithm2e, etc). But I want to write runnable code not only printable one. So, is there any…
rdllopes
  • 131
1
vote
0 answers

What are good ways to format source code in LaTeX?

Criteria for good code formatting: Syntax highlighting Line numbers Code inside should tolerate additional markup (e.g. highlighting salient points) Copy/pasting the code from a PDF should Just Work™ With that last point, I would like for…
1
vote
1 answer

How can I split LaTeX source line into multiple lines?

I want to split LaTeX source line Some text I would like to have in one line~\footnote{ something explained } into something like: Some text I would like to have in one line\ ~\footnote{ something explained } but compiling to the same output. …
abukaj
  • 147
1
vote
0 answers

Robust source search for Tex-sourcecode

We use latex in the backend of a web application which stores exercises. To make exercises easier to find, we thought about implementing a source-code search. But we stumbled upon a lot of problems because there are many ways to typeset the exact…
meneken17
  • 193
1
vote
1 answer

The bottom of the first page of a report

I want to obtain the bottom of my first page of my report like the following Could you please help me with the necessary codes? My attempt: \documentclass[12pt,a4paper]{article} \usepackage{amsfonts,amsmath,amssymb,graphicx} …
Student
  • 1,134
  • 2
  • 9
  • 27
1
vote
1 answer

Avoid overwriting of a source code

Is there a way to protect some part of a LaTeX-Code to avoid overwriting? (Cause I want to allocate the code to someone who shouldn't "touch" some parts of the source code.) Edit: % Begin: don't…
1
vote
0 answers

Good settings for typesetting source code with wide lines?

I'd like to typeset some source code with minted. Unfortunately, a lot this source code runs over 80 columns, some of it up to 132. What are good settings (and open source fonts?) to use with minted so that I can avoid as much line wrapping as…
rityzmon
  • 141
1
vote
2 answers

Box and title of the box containing code

As the attached picture describe, this is what I am trying to replicate. Now the text does not need to be the same, since I am going to write different content inside but I really like the way this Figure is presented, with a title in between two…
0
votes
0 answers

How to efficiently read and edit long expressions

I can get a bit overwhelmed trying to find which frac or h symbol corresponds to the output of a complex expression. An easy way is to copy paste into lyx and edit there as you can edit the output directly by clicking on the right symbol but that…
0
votes
1 answer

How do I access the code that underlies a specific LaTeX package command?

For instance, \legend in a pgfplots bar chart. But in general, it would help as well. In this particular case because I'm trying to build a legend outside an axis environment. I was hoping there'd be a better way than to go trawling through all of…
BlueIris
  • 339
1
2