Skip to main content
The 2024 Developer Survey results are live! See the results

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

Is there a good illustration to accompany a short article about LaTeX?

I'm doing a short recommendation for a Swedish teacher magazine, about letting the pupils learn LaTeX. I'd need some kind of illustration for this. Perhaps a rather complicated formula, some colour ...
Wilhelm's user avatar
  • 75
0 votes
0 answers
50 views

Cleaning up redundant groups in LaTeX after peer-review edits

In my work as a copy editor, I often have to deal with "messy" code. During the peer-review process, authors of the articles we publish typically highlight the changes requested by the ...
Gabriele's user avatar
  • 2,003
0 votes
0 answers
34 views

Importing parts of a .txt file in LaTeX document [duplicate]

Can you define which lines and columns from a .txt file to show up in LaTeX? I tried the \lstinputlisting command where it seems I can only limit the output to specific lines and not columns as well, ...
Charles TeXavier's user avatar
-1 votes
1 answer
150 views

Overleaf project with 2 tex files generating 2 PDF files [duplicate]

I have an Overleaf project with two tex files like below: main.tex \documentclass[anonymous]{} ... \begin{document} \maketitle ... \end{document} review.tex \documentclass[anonymous]{} ... \begin{...
James's user avatar
  • 101
0 votes
0 answers
24 views

How to efficiently read and edit long expressions

I can get a bit overwhelmed trying to find which frac or h symbol corresponds to the output of a complex expression. An easy way is to copy paste into lyx and edit there as you can edit the output ...
userrandrand's user avatar
0 votes
0 answers
8 views

Texmaker: Finding the corresponding code line linked to a section of the PDFLaTeX file [duplicate]

I've recently started using Texmaker to edit on my LaTeX documents (up to now, I mostly used Overleaf or TeXworks), so I am still new to this program's shortcuts. I have been looking for a shortcut in ...
Rye's user avatar
  • 111
1 vote
0 answers
291 views

What are good ways to format source code in LaTeX?

Criteria for good code formatting: Syntax highlighting Line numbers Code inside should tolerate additional markup (e.g. highlighting salient points) Copy/pasting the code from a PDF should Just Work™ ...
Ashton Wiersdorf's user avatar
0 votes
0 answers
29 views

SageTeX does not work when TABs are used as indents

I wrote two practically identical files that use SageTeX to determine whether a positive integer is odd or even. The first example uses tabs for indentation. \documentclass{article} \usepackage{...
vp2523's user avatar
  • 1
1 vote
1 answer
106 views

Keeping hyphenated layout in code - making it disappear from PDF

I have an OCRed document that I want to typeset. However, for validation purposes I want to keep the original layout in the code, but make hyphens disappear from the compiled document. Is there a way ...
Kazi bácsi's user avatar
0 votes
2 answers
99 views

How do you use minted to render a code block in monospaced font with all black text?

How do you use minted to render a code block in teletype font (monospace fixed width font) and all text is the same color (probably black)? What would you write if you wanted all text to be black ...
IdleCustard's user avatar
  • 1,260
0 votes
1 answer
53 views

How do I access the code that underlies a specific LaTeX package command?

For instance, \legend in a pgfplots bar chart. But in general, it would help as well. In this particular case because I'm trying to build a legend outside an axis environment. I was hoping there'd be ...
BlueIris's user avatar
  • 339
1 vote
0 answers
62 views

Words going off the page, why?

I'm using LaTeX to turn in a school assignment which contains code snippets. The code snippets themselves look visually appealing, but the text unfortunately goes off the page if there's too much code ...
Anish G.'s user avatar
1 vote
0 answers
87 views

Creating a clickable link to a local file only in source code

The following situation: I use a program for my data analysis. The program creates a project file. From this file I export the graphics I'm including as figures in the TeX code. Is there a way to ...
dropbear's user avatar
0 votes
0 answers
44 views

What material does latex grammar allow in front of documentclass

I have written software to typeset latex documents in a folder and subfolders. To that end, I have to recognize latex main files, i.e. TEX files which are documents, as opposed to TEX files which are ...
user2609605's user avatar
1 vote
0 answers
124 views

How to easily view source code of a package/command?

Is there a command that directly leads me to the source of a package or command? For example something like $ texinfo viewsource amsmath that shows me the code of amsmath or $ texinfo viewsource ...
vise87785's user avatar
0 votes
1 answer
74 views

Can you standarize the whitespaces of the source code?

I want to know if there is a option to set all the whitespaces in my source code. The whitespaces in my CPP code do not look uniform. Sometimes I leave a space before and after the = sign, sometimes I ...
Maroon Racoon's user avatar
0 votes
0 answers
46 views

Can text that isn't printed but exists in the source code be extraced somehow?

I'm using the exam class to create exams and tests etc. The class has environments for including the solutions to problems and allow you to choose to have those solutions printed after the question. ...
Mephy's user avatar
  • 1
2 votes
1 answer
167 views

ConTeXt: Syntax highlighting of source code within XHTML documents

Background Looking to apply syntax highlighting to source code snippets embedded within XHTML code elements, demarcated with a class attribute to indicate the language. Using: mtx-context | ...
Dave Jarvis's user avatar
0 votes
1 answer
77 views

Renew \[ and \] commands into something more convenient

I'm trying to renew \[ and \] in such a way that it is the same of writing \begin{equation*} \begin{split} \end{split} \end{equation*} I remember a question in TEX SE that contained an attempt in ...
Fral's user avatar
  • 79
3 votes
0 answers
241 views

Using math for listings

I asked a question a while back on how to typeset programs as beautiful math. The suggestion I got was to use listings. But this has been unsatisfactory. Basically my 'programs' are in a gray area ...
Rushi's user avatar
  • 313
0 votes
0 answers
382 views

stix2.sty not found? Stix2 mathbb problem

I have recently asked a question about changing fonts in my LaTeX document (HERE) but when going to compile, it gave me errors. Provided that I installed mathalpha, which I did not have, I have ...
Henry's user avatar
  • 402
0 votes
0 answers
269 views

About LaTeX document preamble

This migh be a silly question but I ask to you LaTeX veterans for help in improving my LaTeX-document preamble. The following is what I usually run as predefinite preamble, but I suspect that I could ...
Henry's user avatar
  • 402
2 votes
1 answer
587 views

How to use \mathbb with this font?

I have been using the Garamond font for almost 10 years and now I decided to change, to try something new, and after having spent some hours in reading and looking for TeX Fonts, I came up with the ...
Henry's user avatar
  • 402
0 votes
0 answers
45 views

latex source code to epub

I wrote a book that consists, basically, of images and tables, and the conversion pdf --> epub gives horrible results. The very appealing index in the pdf (with hyperlinks) looks gorgeous, but ...
Antonio Ortiz's user avatar
0 votes
0 answers
29 views

what's the point of % before line breaks? [duplicate]

I see this pattern of %(s) before line-breaks a lot in packages. What's the point of it? Is it necessary or a convention? For example: \newenvironment{blah}{% some command% some other command% }
Mili's user avatar
  • 1
2 votes
1 answer
707 views

Overleaf: "fontspec all the fonts!": LaTeX source?

Is there a LaTeX source available for the following pdf? https://www.overleaf.com/latex/templates/fontspec-all-the-fonts/hjrpnxhrrtxc Or at least an old version? Or something similar (a document with ...
Michaël's user avatar
  • 174
1 vote
2 answers
809 views

How to render a long code listing in multiple pages with the package minted?

I'm using the package minted for formatting code in my paper. The package minted provides a "listing" environment, which treats the code inside it as a float. It works very well under most ...
Nicole Naumann's user avatar
0 votes
0 answers
109 views

Disable automatic indentation in TeXShop source code

While writing source code in TeXShop, hitting enter normally causes the source to start a new line which is automatically indented as much as the previous line. I'm well aware that the automatic ...
Ishaidc's user avatar
  • 101
0 votes
0 answers
97 views

How to make a personalised ruler?

I wanted to know if and how would it be possible to create a personalised ruler in LaTeX. "Personalised" means I would like to create something like the "famous" IMPERFECTO ruler, ...
Henry's user avatar
  • 402
1 vote
0 answers
70 views

How exactly are parentheses (and other special symbols) rendered in LaTeX? How do they relate to the font used in the document?

I am compiling this sample document: \documentclass{article} \begin{document} \(\sqrt{\left(\frac{2}{3}\right)}\) \(\int_{a}^{b} \sqrt{\left(\frac{2}{x^2}\right)} \,dx\) \(\left(\frac{2}{\frac{2}{\...
Ecco's user avatar
  • 111
1 vote
1 answer
357 views

Listing for file folder-structure as text not working

For my documentation, I need to provide a way on how to structure some Python code in a project. My approach to show it was to simply use a structure of text like this: app/ ├─ ... ├─ controllers/ │ ├...
Remo's user avatar
  • 169
1 vote
1 answer
148 views

Listings show Quotation marks in italic - how to print them in Regular?

I use the listings package for showing source code. I just realized, that double and single quotation marks are printed in italic - they should be printed in regular instead ... Where is the issue? Is ...
Remo's user avatar
  • 169
0 votes
0 answers
37 views

Latex error message [duplicate]

I get this error message when running a markdown program. I am trying to knit to a pdf and for the tangram package, Lancet is a style I need for a report. ! Undefined control sequence. l.79 \...
sephill's user avatar
0 votes
0 answers
57 views

How can I make for an environment to remain contracted?

When I am editing my document in TexMaker I can do the following But when I close TexMaker and I open it after, it occurs that the theorems and definitions don't remain contracted, how can I make for ...
Rata mágica's user avatar
1 vote
1 answer
62 views

Horizontal spacing in document class book

Here is my document from the beginning: \documentclass[11pt, openany]{book} \usepackage[utf8]{inputenc} \usepackage[a4paper, margin=1in]{geometry} \usepackage[T1]{fontenc} \usepackage{lmodern} \...
Happy's user avatar
  • 363
3 votes
0 answers
2k views

Produce copy-paste friendly code blocks in PDFs

I have used lslisting for inserting the code blocks. Requirement is to make the code blocks displayed correctly in the compiled PDF and make them as easy as possible to copy as plain text. Please take ...
Iresh Dissanayaka's user avatar
2 votes
0 answers
271 views

How can color of a default parameter in call, be changed like PyCharm?

I am working on a document that contains some Python codes. I use the following template in Overleaf. \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{listings} \usepackage{xcolor} %...
Loghman's user avatar
  • 121
0 votes
1 answer
73 views

How to retrieve source code of mathchar?

I'm looking for source code of mathchar ∈, latex \in. I want to modify it for my own use.
Arvind's user avatar
  • 33
4 votes
1 answer
9k views

Import source code from Overleaf in Texstudio

I have downloaded the source code from the "Overleaf" of my thesis project. Now I want to edit and work on it with a local TeX editor, e.g. TexStudio or Texmaker. The source code contains ...
Safwan's user avatar
  • 43
1 vote
0 answers
320 views

Change color of a word in .tex code (TeXstudio)

I would like to change the color/highlight the background of a certain word in the source code of a .tex file in Latex (TeXstudio). This is for editing purposes, and I don't want it to output to the ...
Rachel's user avatar
  • 11
1 vote
1 answer
495 views

How can I split LaTeX source line into multiple lines?

I want to split LaTeX source line Some text I would like to have in one line~\footnote{ something explained } into something like: Some text I would like to have in one line\ ~\footnote{ ...
abukaj's user avatar
  • 147
0 votes
0 answers
275 views

What is the option I should use for basicstyle in \lstset if I want Times New Roman font in source code?

I copied the following from somewhere in Internet to the beginning of the latex document to enable math escape in source code listing : \usepackage{listings} \lstset{ basicstyle=\ttfamily, ...
user5280911's user avatar
0 votes
2 answers
464 views

Provide Students with TeX Question Template

I am an instructor, and I prepare homework assignments using the \documentclass{exam}. I know that when I compile to PDF I can use \documentclass[answers]{exam} to generate a compiled PDF that ...
evanb's user avatar
  • 259
0 votes
0 answers
921 views

How could I use .bak file?

I used WinEdt 10 for making tex, but today I found the tex file empty. I found a bak file on my desktop, but I don't know how could I use that. I tried changing .bak to .tex, but it didn't work.
baran's user avatar
  • 57
2 votes
1 answer
9k views

How to create this beautiful Python highlighting in LaTeX with listings?

I found this beautiful Python code highlighting in a PDF today. I want it! But I don't know how to get it? Here is what I tried: \documentclass[10pt,a4paper]{article} \usepackage[utf8]{inputenc} \...
Kuroi Ryū's user avatar
0 votes
1 answer
781 views

Break longer word into lines to fit the box (inputminted?)

I would like to fit the long string (as it is labelled url in the json file) inside the box without overflowing. As far as I understand, breaklines option only helps when strings consist of separated ...
ozturkib's user avatar
  • 160
0 votes
1 answer
259 views

How to reproduce this title inside of a box

I'd like to produce something like this at the beginning of my document: a box with a centered title and details in the angles like the date, the author, etc. What's the code that produces this output?...
Lele99_DD's user avatar
  • 610
1 vote
0 answers
40 views

Beamer: code fragment with listings [duplicate]

I am having difficulty adding code fragment to my slides in beamer with listings package. My code: \documentclass{beamer} %\usepackage[utf8]{inputenc} \usetheme{Warsaw} \usepackage{listings} \title{...
arilwan's user avatar
  • 399
6 votes
2 answers
3k views

Automatic LaTeX code formatting (similar to clang-format) [duplicate]

There are tools such as clang-format that take e.g. an "ugly" (unformatted) C++ source code file and apply specific indentation and other rules to make the code more readable. Is there such ...
MakisH's user avatar
  • 291
0 votes
0 answers
69 views

List of best LaTex Editors in 2020 [duplicate]

There are plenty of people who still raise this concern, Since I too use such editors, I’ve compiled this list of best LaTex editors with good facilities and features. Here are the top ones that I ...
Deepak Gupta's user avatar

1
2 3 4 5
8