{sourcecode} is a collection of computer instructions, here for (La)TeX.
84
votes
4answers
2k views
What is the use of percent signs (%) at the end of lines?
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?
46
votes
5answers
3k views
Tool for cleaning LaTeX code
Is there something like indent for LaTeX? I have a collaborator that is using Scientific Workplace and the code it produces is totally messed up; I know I shouldn't expect miracles, but any machine ...
9
votes
3answers
3k views
How display LaTeX code in LaTeX document?
I'm making Beamer presentation. How I can display LaTeX code inside presentation?
9
votes
2answers
1k views
Colored background in inline listings
I would like to make inline code more distinguishable from the text surrounding it, and I thought that using a background might work (like it is done on the stackexchange pages.)
Since I use the ...
33
votes
5answers
3k views
How can I see the “implementation” of the \LaTeX command?
After reading another question relating to how to see definitions of commands, I tried:
\documentclass{article}
\begin{document}
\show\LaTeX
\end{document}
But this shows me in my logfile:
...
25
votes
2answers
538 views
Are comments safely hidden once the document is compiled?
This is kind of similar to some of the pdf to latex questions but from a different angle. I'm not looking for a complete LaTeX reconstruction method, I want to know if the comments are safely hidden.
...
16
votes
1answer
585 views
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. A Example:
\documentclass[ngerman,fontsize=12pt,pagesize]{scrreprt}
\usepackage{lmodern} ...
5
votes
1answer
1k views
Inline MATLAB code
I want to write MATLAB code in a sentence.
I installed package mcode, no problem if I want to display the code by inserting the code in environment \begin{verbatim} and \end{verbatim}.
How could I ...
15
votes
2answers
321 views
Location inside a LaTeX source code
When viewing a pdf of a long LaTeX document, it can sometimes be difficult to find where a certain equation or a line in the pdf is located in the source code, as there are no page numbers in the ...
4
votes
2answers
113 views
Beautifully format text of an external document
I have some formatted long text files looking like this:
f=50 k_max=420
Iteration Func-count min f(x) Procedure
0 1 7.07212e-09
1 2 ...
2
votes
1answer
2k views
TeXStudio doesn't recognize some commands
I'm starting to use TeXStudio. I'm having some issues, for example with
\begin{align*}
\sqrt[n]{a}^2-\sqrt[n]{ab}&=m\sqrt[n]{a}\\
\end{align*}
When i put the point on align* i get a small ...
8
votes
2answers
346 views
What are good packages / techniques for writing more readable LaTeX *code*?
A while ago I stumbled upon the semantic package --- its 'math ligatures' feature in particular --- and the whole way in which I write math-code in LaTeX changed.
Instead of
\[
\sem{\sigma}_s^x ...
31
votes
2answers
2k views
Styleguide for LaTeX similar to the Google styleguides?
Even though I don't work at Google, the Google Styleguides have been very helpful for me in adopting consistent, readable style conventions for my code. Unfortunately, there is no Google Styleguide ...
6
votes
1answer
316 views
How to Format C Program Code Block Nicely
I am using the following settings to format my code blocks:
% xxxxxxxxxxxxxxxxxxxxxxxxx Code Snippet STARTS xxxxxxxxxxxxxxxxxxxxxx
\lstset{
language=C, % choose the language of ...
3
votes
1answer
209 views
Background images for code listings in beamer
I asked this question originally in attempt to get background images behind my code listings.
Background images for code listings
What I did not mention is that I am using the beamer package for ...
11
votes
1answer
1k views
Where I can find the source code of pdflatex.exe?
Where I can find the source code of pdflatex.exe?
Edit 1
This is quoted from the link given by @TH.
pdfTeX is built on top of TeX, written by Donald Knuth cum suis (Liang and
so), and eTeX, ...
14
votes
1answer
363 views
Are there guidelines on how to read commented sources of LaTeX packages?
I'm trying to read source2e.pdf (texdoc source2e on the command line), but I'm stumped. It seems a rather mysterious tome to me. As I understand from this answer about what arguments a command ...
9
votes
1answer
779 views
Source Code Indentation
I was wondering if it is possible to indent the code like in most programming languages as shown below:
\part
\chapter
\section
\subsection etc.
This would make the ...
7
votes
3answers
1k views
How to put C++ source code into beamer slides [duplicate]
Possible Duplicate:
How display LaTeX code in LaTeX document?
How do I fit java style source code in one frame in beamer?
How do I add C++ formatted and coloured source code to my beamer ...
2
votes
1answer
508 views
How to get Matlab code into a LaTeX document?
I'm trying to put in my thesis matlab code but the results are not very good. I would get something like that but I don't know what packages using and how to create this result:
6
votes
1answer
842 views
What are the standard styles to format LaTeX source code?
In any other programming languages, we have several ways to format our source code. For example, some of the standard styles are:
Allman(ANSI)
K&R
GNU
....
Within LaTeX, I couldn't find a neat ...
4
votes
1answer
102 views
Creating a table around a java script code highlighted using minted
I would like to create a block around javascript code in latex.
I use minted package for format highlighting.
Here is my example code:
\documentclass[]{article}
\usepackage{minted}
%opening
...
3
votes
1answer
843 views
Is there a good definition for highlighting PHP code in listings?
Does someone have a good definition for highlighting PHP code with the listings package?
1
vote
3answers
723 views
lstlisting with c++: spaces around scope resolution operator
I am having a hard time to make the output of lstlisting for c++ source look good. Currently, I am stuck with a problem to reduce the amount of space around the scope resolution operator ::. See the ...