The code tag has no wiki summary.
16
votes
2answers
823 views
Print programs with its proper syntax
I have defined my own language whose syntax is very close to the one of Pascal. I would like to type the following program for instance. Many people use the packages algorithmicx or algorithm2e to ...
19
votes
3answers
1k views
LaTeX code sniffer and/or beautifier?
I'm looking for a LaTeX code sniffer and/or code beautifier, because I'm creating a CI server for my LaTeX books and I wanted a few things. :D
46
votes
6answers
1k views
How bad for TeX is omitting braces {}, even if the result is the same?
Sometimes writing braces and omitting them produces the same result:
\tilde{\psi} \mathrm{e}^{\mathrm{i} \pi}
vs
\tilde \psi \mathrm e^{\mathrm i \pi}
Or (taken from Werner's comment below)
...
10
votes
1answer
470 views
\listings code style for HTML5 (CSS, HTML, JavaScript)
I would like to create a code style for HTML5 that can be used with the \listings package.
An HTML5 document consists of three languages: CSS, HTML and JavaScript. That makes the whole thing a bit ...
37
votes
3answers
2k views
Are there any coding style guidelines for LaTeX?
I have been using LaTeX for a long time now, but still all my document files look a bit messy. Now I want to get rid of this bad habit and get some order into my code.
That is why I am wondering ...
14
votes
1answer
3k views
How to properly code a TeX file, or at least avoid `badness 10000`
I'm coding a TeX file and although the .pdf is correctly rendered, I'm using "stone age" tools to code it. As some examples, I use \\ to leave a line space between two paragraphs, or \noindent in ...
15
votes
2answers
2k views
Code spanning over two pages with minted, inside listing with caption
I am trying using minted to display some code in my document, but the code is long and spans over two pages, this works fine, however when I place my code inside
\begin{listing}
...
11
votes
4answers
316 views
How to improve my PSTricks code to construct a triangle diagram?
This question is similar to How to improve my PSTricks code to construct a triangle number diagram?.
Consider the following example.
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
...
2
votes
4answers
516 views
How to place a program and a text side by side?
My first question is how you write a program in LaTeX, with and without a line number for each line.
The second question is, because often my program is not too large, I want to save some space for ...
7
votes
2answers
169 views
How to improve my PSTricks code to construct a triangle number diagram?
This question is similar to How to improve my PSTricks code to construct a triangle diagram?.
Consider the following example.
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
...
2
votes
2answers
119 views
Definition of PSTricks constant (again) and improvement of code
Consider the following example. (This is either the last one or the second to last.)
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}
...
5
votes
2answers
246 views
Aligned, hanging indents in non-monospaced code
I want to typeset a piece of code containing line breaks. New lines should indent to a specified point in the previous line. Here is a monospaced example to illustrate what I mean. Notice how ...
2
votes
1answer
106 views
Syntax highlighting for different programming languages [duplicate]
In my paper I want to include some source codes with colored sytax. For syntax highlighting I use the listings package:
\lstset{frame=tb,
language={[Visual]Basic},
aboveskip=3mm,
belowskip=3mm,
...
2
votes
1answer
478 views
insert MAPLE algorithm to LaTeX
I am writing my dissertation through LaTeX, and I want to insert the code from MAPLE, it is about 2 pages and I am not sure how to include the algorithm, do you have any idea how am I going to do it?
9
votes
2answers
247 views
Two code blocks working syncronously
I need two code blocks in my beamer frame. One will be the code and other will be the output for each line of code.
I want to uncover each code line and corresponding output line.
So, first it will ...
6
votes
1answer
552 views
Code readability
I'm getting my head around LaTeX, and I find really awesome the fact that the documents are completely editable with a plain text editor, while getting a really neat and professional output.
I'm ...
16
votes
4answers
511 views
Is this branching code I wrote a bit obfuscated?
I've been away for a while and I forget if this sort of question is appropriate, but here goes. Recently I wrote some code (in expl3 but I hope it's clear enough) and in hindsight I wonder on its ...
5
votes
1answer
177 views
Problem formatting java code in my latex document (overshooting the page)
My code is being formatted in a way that makes it drift off the page when it's too long rather than just jump to a new line. I have tried lots of different things, pasted all kinds of examples from ...
6
votes
2answers
159 views
Improve PSTricks code for drawing of the Olympic flag
Consider the following example.
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
\usepackage{auto-pst-pdf,pstricks-add}
\usepackage[locale=DE]{siunitx}
\ExplSyntaxOn
\cs_new_eq:NN ...
4
votes
1answer
562 views
\fbox inside listings
I am trying to highlight a specific line inside a listing with listinline. The code I am currently using looks like this:
\begin{lstlisting}[escapechar=!]
class A {
void m() {
B b = ...
...
3
votes
1answer
79 views
Definition of PSTricks constant and improvement of code for drawing of Pantheon
Consider the following.
Code
% pdflatex -shell-escape test.tex
\documentclass{article}
\usepackage{
auto-pst-pdf,
pst-eucl,
pstricks-add
}
\usepackage{siunitx}
\begin{document}
...
3
votes
1answer
90 views
Minted shows formatted tex code instead of intended source
I use WinShell with PDFLatex on Windows 7. I managed to install Pygmentize and compile the minimum example without errors:
\documentclass{article}
\usepackage{minted}
\begin{document}
inline: ...
2
votes
0answers
152 views
Source code line numbers in PDF [duplicate]
Possible Duplicate:
Extended draft mode which includes source information for manual print-out to source synchronisation
I am writing a document in LaTeX which I compile to PDF, which I ...
1
vote
2answers
381 views
input filename as caption in listing
I'm working on the following piece of code
\newcommand{\mycin}[1]{% new command for icluding piece of code from external files
\lstinputlisting{#1}
}
I want to add a caption that reflects the ...
