{sourcecode} is a collection of computer instructions, here for (La)TeX.

learn more… | top users | synonyms

3
votes
0answers
268 views

Regular expressions in listings [closed]

I'm looking for a possibility to use regular expression in listings. I'd like to highlight each N thats followed by 4 decimal numbers for example N1234. How can I achieve that? Here is an example: ...
1
vote
0answers
82 views

spacing before scope resolution operator [closed]

I'm new to LaTeX and I have encountered a problem with the listings package, I have a space before the :: operator of C++ . after reading lstlisting with c++: spaces around scope resolution operator ...
2
votes
1answer
218 views

label for package: fancyvrb

I have a latex code for a computer program code like as specified in here. I want to write a label to this code. I searched for it but was unable to find how to add label for the source code. Any help ...
1
vote
0answers
389 views

Auto-indentation of LaTeX Source code in TeXShop [duplicate]

Sometimes, I find it a bit hard to manually indent my code so that all the \begin{...}'s and \end{...}'s align vertically in my .tex source code. In some code development environments, I know that ...
1
vote
1answer
173 views

Displaying (source)Code in research article [duplicate]

I have this urgent need to display two pieces of code side by side for comparison in my article. Displaying a code, I've couple of requirement Should indent properly Output should be syntax ...
1
vote
1answer
264 views

Word count excluding certain environments

I would like a way to get a word count while ignoring certain environments. The reason for this is that I have quite a bit of pseudocode enclosed within multiple verbatim blocks. Ideally, a solution ...
4
votes
1answer
164 views

Embed distributed LaTeX file/code to the PDF?

I have read of the possibility to embed the LaTeX source in a generated PDF, see the question here. Do you know of a way to do this with distributed TeX file, i.e. for a TeX file which is stored in ...
4
votes
1answer
446 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 ...
9
votes
2answers
572 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 ...
26
votes
2answers
1k views

What are coding conventions in LaTeX?

What do I mean by Convention? First of all, allow me to clear myself about the word 'conventions. As most of you already know, coding conventions are a set of guidelines for a specific programming ...
0
votes
0answers
156 views

Usage of curly braces in math mode for macros [duplicate]

Possible Duplicate: Why do people use unnecessary braces? How bad for TeX is omitting braces {}, even if the result is the same? I wanted to know what is the preffered way of writing ...
4
votes
1answer
374 views

wrapping inline long lines and adding background color

Objective I'm trying to achieve the following output. Here's the code I used to produce it. I had to hack it \begin{document} \begin{description} \item In ...
6
votes
1answer
915 views

Enforce a line-break inside \lstinline

I use \lstinline{foo} from the listings package to set pieces of code in regular text. To get automatic line-breaks I use the following options: \lstset{ breaklines=true, breakatwhitespace=true, ...
6
votes
2answers
166 views

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?
6
votes
1answer
626 views

How to cite sourcecode from an svn repository

As part of my thesis I read some sourcecode. Unfortunately this sourcecode is only available as an svn repository. How do I write a reference to it? The shortest way I found of accessing it is: svn ...
7
votes
2answers
1k views

Folding entire section in AUCTeX?

I'm new to AUCTeX and I wonder: is it possible to fold entire sections or subsections of a LaTeX document for a better overview, so that they are only represented by their headline (kind of a tree ...
6
votes
2answers
330 views

C++ operators ^=, <<=, >>= misinterpreted

I write a list of C/C++ operators of the following form : \texttt{operator+=}, \texttt{operator-=}, \texttt{operator*=}... The problem is that \texttt{operator\^=}, \texttt{operator>>=}, ...
2
votes
1answer
3k 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:
2
votes
0answers
126 views

The meaning of the percent sign in LaTeX coding [duplicate]

Possible Duplicate: What is the use of percent signs (%) at the end of lines? I know that % is commonly used to uncomment parts of the code, but recently I read that there is another use ...
6
votes
2answers
339 views

Comparing two versions of programming code with LaTeX

I'd like to compare two versions of program with vertical line between them. How can I do this with LaTeX?
8
votes
1answer
3k views

Insert code or text file in latex as is?

Question : How can I insert a txt file ( a source code) as such in latex without any change in indentation, tabs, formatting etc? Scenario : Consider I have a text file as below ( It is a part of a ...
9
votes
2answers
6k views

What's the best way to typeset C++ codes in latex?

I'm participating in a programming contest and we are allowed to prepare a team reference document which must not exceed 25 pages. Typically we will prepare many code templates and this year I'm ...
2
votes
1answer
204 views

Code for reading Metafont definitions

I need some C code to generate Bezier curves from Metafont source code. Ideally, I'd like to have a C/C++ function with the following specifications: Input: an array of text strings (the lines in the ...
3
votes
3answers
600 views

Recommendation for homework use [closed]

I'm re-discovering LaTeX after an absence of 15-17 years. Sadly all my previous skills are gone so I'm starting from scratch. I am taking two grad courses for which I have to submit assignments every ...
2
votes
1answer
156 views

Recover TeX source from automatically generated LaTeX files

Maybe the question can not be exactly understood from the title. So, to automate things a bit, instead of rewriting everything when adding different pictures and tables, code was made to add ...
0
votes
0answers
58 views

How to format a block of source code? [duplicate]

Possible Duplicate: Package to indent and syntax highlight C++ code I want to format a block of C source code using TeX, how can I accomplish this work? for example: int main() { ...
0
votes
1answer
170 views

Question about ArsClassica codes

I would to know for what is used the code below (Last lines code) in arsclassica.sty. Also I would to know why in arsclassica-settings there are some repetitions of \lstset is not the same thing put ...
7
votes
3answers
254 views

Expanding a minted command inside a macro

I am currently trying to speed up the compile time of a document that uses minted. I would like to be able to have certain language features (and style) appear the same in both a minted environment ...
5
votes
1answer
1k views

How to get a double column verbatim in a single column table, in a double column document?

I have a double column document in which I need to place two source code listings side by side. Naturally a two column document's single column is too narrow so the two listings need to span the page ...
1
vote
1answer
502 views

How to write program text in table

I have to write a table with two columns and in each column I have to place small C code snippets. Using the \code{} in each column seems to be very tedious because I have to write \code{} in each ...
5
votes
1answer
3k 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 ...
2
votes
0answers
453 views

Insert a block comment title in Kile [closed]

I would like to know whether it is possible in Kile to define a script to insert a centered commented block. I often mark different parts of my code with those kind of titles: ...
8
votes
3answers
6k 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 ...
20
votes
1answer
1k 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. An Example: \documentclass[ngerman,fontsize=12pt,pagesize]{scrreprt} ...
6
votes
1answer
584 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 ...
5
votes
1answer
545 views

Is there a default / official / standard Vim indentation file for TeX, or just best practices for TeX source indentation?

If you see here, the author mentions an "official version" of an indentation script from Johannes Zellner. The link is broken and while there are traces of Zellner all over the interwebs, I can't find ...
3
votes
1answer
324 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 ...
6
votes
1answer
213 views

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 ...
3
votes
1answer
917 views

Alternative way to print source code [duplicate]

Possible Duplicate: Syntax Coloring in LaTeX I want to add source code of my program in document but verbatim really bugs me. All that ugly fonts and stuff.
2
votes
1answer
299 views

treating multiple code listings as one figure (listings package)

Please note that I am quite new to tex/latex. For my paper I need to reference specific parts of my source code as one code listing. This allows me to skip specific lines of the source code that are ...
29
votes
2answers
891 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. ...
9
votes
1answer
444 views

Clean black & white style for minted

I'm using minted to format code in a book. Except for the bw theme, I only see colored styles, which is nice for producing a PDF, but not ideal for printing in black & white. Is there a clean ...
8
votes
2answers
805 views

TeXShop: Force spaces instead of tabs

Is there a way to make TeXShop insert an arbitrary number of spaces when I press the tab key instead of inserting a tab? This functionality is in TeXnicle and I really like it, but TeXShop is my ...
50
votes
9answers
2k views

What are the pros and cons of using hard wrapping, and why is it so common with LaTeX?

It seems that hard-wrapping - i.e. inserting a newline when the line reaches a certain threshold - is extremely common in the LaTeX source when writing technical papers, either by manually inserting ...
6
votes
1answer
3k 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?
4
votes
2answers
441 views

Problems When Escaping from Listings

I would like to use LaTeX to document my C++ code, since I am able to typeset mathematics easily, as well as create diagrams using TikZ. I made a minimal LaTeX template for testing, but I have already ...
3
votes
3answers
2k views

Temporarily suppress two-column layout in Oxford Bioinformatics template

The Oxford Bioinformatics journal's template is one of my favorites and I use it for many of my school assignments. The template uses a two-column layout, but in an appendix at the end of the document ...
2
votes
2answers
519 views

How to customize Tex/latex commands to perform system calls from shared libraries / dlls

Alright - let me make this simple and straight: How can I take advantage of the tex/latex parsing mechanism in a custom c/c++ application that need scripting/parsing support? I see two ways: ...
6
votes
5answers
7k views

Verbatim environment with correct tab handling and special characters

I'm looking for an environment similar to Verbatim which will allow me to say something like the following code (which uses indentation instead of spaces): \documentclass{article} ...
0
votes
1answer
557 views

Is there a beamer auto-indent program? [duplicate]

Possible Duplicate: Tool for cleaning LaTeX code Beamer presentation files are very structures, they have sections, in which you find subsections, which include frames that have titles and ...