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.

Filter by
Sorted by
Tagged with
1
vote
0answers
91 views

Is it possible to get the latex version rather than pdf version of papers? [closed]

I am going to learn latex, I think the quickest way to do it is to imitate good latex examples. The latex version of the published papers are excellent examples, is it possible to download the latex ...
1
vote
1answer
52 views

How to make annotation to code listings

Is it possible to make annotations to source codes like below?
0
votes
0answers
37 views

Must PDF always eat source code indentation? [duplicate]

The packages listings and minted present source code inline. My publication target is PDF. From my own documents as well as from the documentation for those two packages, copying and pasting the ...
1
vote
0answers
33 views

Bring several lines together to fill blank spaces in TeXmaker

Suppose in a TeXmaker document that looks like something like phrase 1 phrase 2 phrase 3 phrase 100 or a sentence that looks like A quick brown fox jumps over the ...
1
vote
1answer
37 views

What is the correct code this algorithm in latex

\documentclass{article} \usepackage{amsmath} \usepackage{algorithm} \usepackage[noend]{algpseudocode} \makeatletter \def\BState{\State\hskip-\ALG@thistlm} \makeatother \begin{document} \begin{...
0
votes
0answers
26 views

Minted package does not recognize lexer inside listing

I have a problem with the minted package. I am using two different lexers, juliaand jlcon. The first one properly highlights code, but the second one only works if the code is not inside a ...
1
vote
1answer
37 views

pgfplots: Are parentheses mandatory in axis environments?

Assumed we have this little code snippet: \begin{tikzpicture} \begin{axis}[ date coordinates in = x, table/col sep = semicolon, date ZERO ...
6
votes
4answers
836 views

Two spaces in LaTeX code

I have a simple question: does it make any difference whether at some point I have two spaces instead of one in the source code, say after a period? That is, will PdfTeX ever output different things ...
1
vote
2answers
55 views

How can we Define our own Simple Environment for Source Code?

Inside of our document we wish to define a new environment for blocks of source code \newenvironment{srcblock}% % Define the environment Later, we will use the environment: \begin{srcblock} % use ...
0
votes
1answer
63 views

What is the advantage of using a pseudocode package instead of simply putting code inside of a verbatim block? [closed]

What are the advantages of using a pseudocode package (like algorithm2e) above simply putting code inside of a verbatim block? Edit: In order to make the question less vague, I will say this: ...
2
votes
1answer
54 views

Hebrew within sourcecode

I need to include LaTeX source code, which contains Hebrew text, within an Hebrew document. I tried doing so within a verbatim environment, but Hebrew words appear in opposite order. Any solution ...
2
votes
1answer
39 views

Problem inserting C snippet

I am trying to insert an snippet like this But when I write \usepackage{listings} \lstset{language=C} \begin{document} \begin{lstlisting} typedef double real_t; // Esto casi seguro necesita ser tipo ...
3
votes
2answers
214 views

Add keywords at the bottom of a document

I want to use \documentclass[12pt,a4paper]{article} in the place of \documentclass[12pt,reqno]{amsart}. However I want to add the following in the bottom of the first page This is my codes \...
0
votes
2answers
38 views

Reducing space in the Table of Contents

I'm using the following codes \documentclass[12pt,a4paper]{report} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Useful Packages %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %---------------------math--------...
0
votes
1answer
63 views

remove all insignificant whitespace from tex source

Is there an existing tool for removing all insignificant whitespace from the source of a tex document? I'd like to run this before calling latexindent to see if I can have an autoformatter tool that ...
1
vote
1answer
32 views

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{...
4
votes
1answer
370 views

How to use true/false inside definitions?

Suppose you want to define page style depending on a boolean value. I think both constructions below have equivalent output (or not?), but which is better/more indicated/professional/elegant? \if@...
2
votes
1answer
49 views

Documentation of loop over item

In this answer there is a loop construct used called loop over item. I am looking for a documentation of this and for a reference in which file it is defined. \ifdate{workday} { \tikzset{every ...
8
votes
0answers
181 views

LaTeX Uglifier / obfuscator

For JavaScript you have e.g. js uglifier, which obfuscates the javascript so that it is infeasible for humans to read the javascript code. Also, judging by @DavidCarlisle's xii.tex (see below), ...
2
votes
1answer
86 views

How do I get separate source code functions in one line?

It it difficult to create a question for this. I want to tex source code like here. Is this with listings? Which package do they use? How do I get the separate procedures in one line? And how do I get ...
6
votes
1answer
503 views

How to embedded source code on-demand into PDF?

I wondered if its possible to embed source code of some software you are writing about into the PDF but not displayed by default. E.g. you have a long script I would be nice if the user/reader could ...
0
votes
1answer
179 views

How to import Java source code from multiple folders to LaTeX

I want to add all my Java source code to an appendix. But I have 20 projects. Is there a possibility to just tell LaTeX where the folder with the different projects are, and LaTeX collects all the ...
2
votes
1answer
292 views

LaTeX convention how to indent source? [closed]

I am new at LaTeX and I am asking myself at the moment if there is a convention how to indent the source code. For example: \begin{itemize} \item erstes Stichwort \item zweites Stichwort \end{...
1
vote
0answers
138 views

Minted vs matlab-prettifier for thesis [closed]

I am writing my PhD thesis now for which I need to list snippets of source-code within the main text and full listings in the appendix. I did my coding entirely in MATLAB using advanced constructs ...
1
vote
1answer
200 views

Lyx source code from tex extension to lyx

A friend sent me a lyx file to edit it. I had no idea how lyx works so I assumed it was similar to the usual latex. Since I hadn't lyx installed, I opened with texmaker as a .tex file and edited. I ...
6
votes
1answer
70 views

How to emphasize in a listing and keep source columns aligned?

I use moredelim with * to highlight some text in my lstlisting. \documentclass{article} \usepackage{listings} \usepackage[LY1]{fontenc} \renewcommand{\rmdefault}{ptm} \renewcommand{\ttdefault}{...
1
vote
1answer
66 views

Malformed dots when using listings

How is it possible to compile such page? \begin{lstlisting} ⡂⡀⣀⢀⣄⡀⣰⡉⡀⠀⡀⡀⣀⠀⢀⣀⢀⣄⡀⡂⢀⣀⡀⢀⢀⡀⠀⡰⣀⠀⣀⠀⡂⡀⣀⢀⣄⡰⡀⢠⠂ ⡇⡏⠀⡇⡇⠀⢸⠀⡇⢀⡇⡏⠀⡇⣏⠀⠀⡇⠀⡇⣏⠀⣹⢸⠁⢸⠀⡇⢈⠷⡁⠀⡇⡏⠀⡇⡇⠀⡇⢼⠀ ⠁⠁⠀⠁⠈⠁⠈⠀⠈⠁⠁⠁⠀⠁⠈⠉⠀⠈⠁⠁⠈⠉⠁⠈⠀⠈⠀⠱⠉⠀⠉⠀⠁⠁⠀⠁⠈⠱⠁⠘⠄ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀...
0
votes
1answer
72 views

go to source is not working with dvi-ps-pdf-chain in texstudio 2.10.8

I am using eps figures and and I want to put them into my latex file. everything is working with choosing dvi-ps-pdf-chain except "go to source". when I use this "go to source" is disappeared. It is ...
1
vote
1answer
300 views

Code validation in minted package? How to disable it?

I'm using minted for inserting syntax highlighted HTML code in my document. But it isn't simple HTML (valid HTML I mean) and has some special characters and definitions (if you're interested, it's ...
6
votes
2answers
256 views

Can one customize lstlisting environment?

I want to add some Python source code to my LaTeX document, but I want to apply some customization. Currently, I have something like this: \documentclass{article} \usepackage[utf8]{inputenc} \...
-1
votes
1answer
78 views

Writing code for image [closed]

Can someone help me to write code for the following figure. I want to insert it in a presentation and am not well versed with graphics?
3
votes
0answers
588 views

Formatting bash with listings

I writing a documentation in LaTeX about Linux Bash resp. Shell script. And I'm having some problems: How can I start a formatting at the beginning of a line? How can I format between two signs, but ...
3
votes
1answer
172 views

LaTeX(2e) Programming vs. expl3 (which to learn)

Recently, I've decided it would be a useful and interesting skill to be able to program LaTeX classes, macros etc, and so had a look around about what resources existed (this question was very helpful)...
0
votes
2answers
59 views

How to have one code to be typeset both as final and as source code [duplicate]

I'm very limited in writing Latex code and I could not find how to solve my problem searching in the forum ou googling around. My problem: I have to write a document with many algorithms and show ...
3
votes
1answer
863 views

Using listings package with beamer/block environments for displaying source code

I use beamer with semiverbatim environment to show source code. \documentclass{beamer} \setbeamercolor{background canvas}{bg=yellow} \useinnertheme[shadow]{rounded} \setbeamercolor{block title ...
0
votes
0answers
64 views

Updating theorem number in tex file

I honestly do not know how to search for this feature. Recently, I had an experience with skylatex for proofreading. One of the features I really enjoyed was that once I compiled my source file, the ...
1
vote
1answer
349 views

How do I find the meaning of latex documentclass options?

I saw someone using the [final] option for the beamer documentclass and wanted to see what it did. So I searched the package documentation here on CTAN and also found the directory on my computer that ...
2
votes
1answer
138 views

How to achieve this two column style?

I’d like to add some code examples in two column form. The left is a description and the right is the REPL input code and output. Here’s an example of what I’d like to achieve: Are there well known ...
1
vote
1answer
44 views

Why ~ is not shown in place in R source listings? [duplicate]

My sample code is- \documentclass{article} \usepackage{listings} \usepackage{xcolor} \begin{document} \lstinputlisting[numbers=left,backgroundcolor=\color{lightgray},language=R]{code.R} \end{document}...
1
vote
1answer
77 views

Scantokens and Newlines

I'm having problems with the usage of scantokens. I'm trying to convert a list that I read in while under the effects of \obeylines. For some reason, any time I use scantokens on my list, it stops ...
2
votes
1answer
370 views

Reading LuaTeX source

TL;DR: I want to read the source code of LuaTeX. How and where? I want to know exactly how the Knuth-Plass algorithm for line breaking is implemented in LuaTeX. Not an explanation, I want the source. ...
0
votes
1answer
1k views

How to paste source code into LaTeX with correct indentation

I am trying to use \begin{lstlisting} ... \end{lstlisting} to include some Python source code in LaTeX. When I paste the following code block: def plot_c(Yhat, Y, X): plt.figure() plt....
9
votes
1answer
221 views

Is there a newmarks command?

Is there a way to allocate the e-tex marks with names, similar to things like \newtoks? It shouldn't be too hard to implement, I just want to know if it exists already. To be clear: e-tex makes ...
4
votes
1answer
133 views

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 ...
0
votes
0answers
54 views

Bake '\today' into source file (or custom aux-file)

This is supposed to be a part of: Calendar instead of table of contents. Situation As mentioned I want to create a calendar-ish table of contents. The link to the heading (of eg. a chapter) should ...
0
votes
0answers
42 views

Check for equality of boxes [duplicate]

Is there any way to check for what the contents of a box are? I see that there's a way to check if it's void, and what type of box it is, but can you check what's in it? I'm working on a reflowing ...
5
votes
1answer
127 views

How can I include the Spanish characters in source code?

Hi i need help for fix this code in the part \begin{lstlisting}[style=Java] i have 2 errors can read the source code from another file and add a main .tex file? PD: i am new in LaTeX - PD 2: my ...
3
votes
1answer
78 views

Why is reinsertion in multicol different than usual?

I've recently been having an issue with multicol and dblfnote. The solution to the issue was to change the definition in multicol of \reinsert@footnote from \ifvoid\footins\else\insert\footins{}\fi ...
2
votes
1answer
92 views

How to trace all changes to a box

I'm currently knee-deep in debugging a mysterious bug in my daily usage of TeX. I have a fairly substantial list of packages that I use all at the same time, and I can't seem to track down the cause ...
3
votes
2answers
388 views

lstlisting - giving source - smaller font, alongside caption, preferably above caption

I would like to separate description of listing (\caption{}) from source of listing. What I search for is like \footnotesize in presenting pictures (\begin{figure}). I was searching for this at latex ...