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

learn more… | top users | synonyms

4
votes
1answer
285 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
499 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
151 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?
5
votes
1answer
435 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 ...
5
votes
2answers
724 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
273 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
2k 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
122 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
283 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?
7
votes
1answer
2k 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
3k 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
193 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
511 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
153 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
153 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
229 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
830 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
476 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
358 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
4k 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 ...
19
votes
1answer
969 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
477 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
462 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
286 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 ...
5
votes
1answer
191 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
727 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
284 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 ...
27
votes
2answers
773 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. ...
7
votes
1answer
370 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
640 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 ...
47
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 ...
5
votes
1answer
2k 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
380 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 ...
2
votes
3answers
1k 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
467 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: ...
5
votes
5answers
6k 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
526 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 ...
1
vote
3answers
1k 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 ...
5
votes
1answer
5k 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 ...
2
votes
2answers
217 views

Is there a way to make ChkTeX ignore TikZ code

ChkTeX does not like TikZ, and will report a bunch of errors. Is there a way to make ChkTex ignore TikZ code?
10
votes
1answer
989 views

Numbers and programming code

This happens when I use programming code and enumeration, how can I add a gap between the numbering and the line numbers of the code. I'm using this in LaTeX Preamble: \usepackage{listings} ...
4
votes
1answer
424 views

Beamer: How to do src highlighting when src is split with \only<> command? [duplicate]

Thanks to Marc van Dongen there is a template of a "step by step" programming tutorial (with a sample layout in his question): How to create step by step annotated programming tutorial in LaTeX? . I ...
4
votes
1answer
1k views

Including a text file in LaTeX

I write a program by DevC++ compiler and save it by .cpp format, and want to paste the code in my editor, Do I have to paste all the code each time? Is there a way to include the file instead of ...
2
votes
0answers
121 views

Automatic source document formatting [duplicate]

Possible Duplicate: Tool for cleaning LaTeX code This might not be a TeX question, strictly speaking but I'm sure this is the right forum to ask this: Is there a tool that can format the ...
2
votes
2answers
765 views

Source code for examples in TikZ/PGF manual

I am starting to learn TikZ. I was wondering if the source code for all examples in the TikZ manual (2.10 version) is available somewhere for download?
10
votes
1answer
1k 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
1answer
236 views

How would I recursively add the document source code to an appendix?

For kicks, I would like to include the source code as an appendix. It's rather superfluous, yes, but it's puzzling. I commonly have documents that are structured thusly: main.tex includes: ...
4
votes
2answers
628 views

Finding TeX Sources in C

Why is it so hard to find TeX sources in C? I know the full source code is included in the tex.web and pdftex.web files, but isn't there any way to convert them to plain C code?