Hot answers tagged

22

I'll use an example from the TeXBook source This manual is intended for people who have never used \TeX\ before, as well as for experienced \TeX\ hackers. In other words, it's supposed to be a panacea that satisfies everybody, at the risk of satisfying nobody. Everything you need to know about \TeX\ is explained here somewhere, and so are a lot of things ...


16

I found no tool that can deal with formatting, but for extracting the text on Linux, there is a two step procedure that produces good results: $ pdf2ps paper.pdf $ ps2ascii paper.ps > paper.txt From: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=recovertex


15

Check out the new Mathpix desktop app. It let's you take a screenshot of any math, physics, etc. on your desktop and converts it into LaTex, already copied to your clipboard so all you have to do is paste into your LaTex/markdown editor. Only available for MacOS but Window and Linux versions coming soon.. Hope this helps!


14

The package embedall has been made exactly for that: Just include \usepackage{embedall} just before \begin{document} and it will embed all graphics, listings, and the tex source. side note: The CTAN tag archival has more related tools listed. For instance, mkjobtexmf saves all .sty files. They could be embedded in the PDF, but I am unsure whether that's ...


13

The main problem is here that the error messages gives you the line number in which line the error was found. That means it could be in that line or the lines before. If you have long or very long lines LaTeX can not be very exact helping you to find fast the error in the mentioned line. The best practice is to have short lines. In my case I used the ...


12

TeX engines can essentially deal with lines of any (reasonable) length so in that sense there is no forced limitation and starting new lines largely comes down to personal preferences and your perception of readability. There is however at least one area in which short lines (be it less than 80 chars or not) is superior longer ones (or worse in my opinion ...


9

Short version: it's complicated, but mostly systems automatically do the right thing. Medium version: There are only really two classes of differences in "types of plain text" Line endings and encoding. Line ending is what typically distinguishes plain text file transfer from "binary" as the line endings are converted to the format used on the platform, ...


9

I'll break this down into two cases: 1. When defining macros, drawing tikz pictures and othwerwise writing mostly code: Short lines work well. Not necessarily one statement per line as is conventional in some languages - this is easy enough to read: %And this implements a command "warn" for notes to self. \newcommand\warn[1]{{\textcolor{red}{\textbf{**#...


8

If you have a command line base64 decoder (base64 -d here) and allow pdflatex --shell-escape to run external commands then you do not need anything other than the standard graphics package. Here I include a base64 encoded pdf image. \documentclass{article} \begin{filecontents*}{\jobname.64} ...


8

There are systems, but at the current state of the technology they are unlikely to be as fast or accurate as simply typing in the matrix. there is hardly any additional markup required, just a & separator between the cells. Here for example is a hand (well mouse) drawn matrix in the Math Input panel which is standard in Windows 7. The lower bit is hand ...


7

The solutions mentioned by @frabjous @eunice work great. To add to the answers above to make a complete list of tools available online for converting things to TeX, I have been using: ------------mathpix------------ and it works really well. This tool does not directly convert PDFs to TeX code, however, it is super useful to convert equations to TeX code ...


7

as a general rule, i would always recommend using the ctan copy, which is in this case at in the ctan graphics tree as it happens (in this case) the “private” copy of the file is the same as that on ctan. in general, one shouldn't count on that, since the "private" location may be an experimental version offered for testing. finally -- remember that (...


7

The "hidden" embedded file in the blog post is not an embedded file in the sense of the PDF standard, so the question is what you really want: If you only want to include the content from the file in the generated PDF, you can add a PDF stream: If you write \immediate\pdfobj file{some-filename.tex}, the file some-filename.tex is copied into the PDF as a ...


7

It was a "feature" of standard Pascal that there was no universal "string" type, every length was a separate type. That is, "string of length 40" is a different type from "string of length 50"; a function can be declared to accept arguments of either one type or the other, not both. (In fact Pascal had no string type at all, it had arrays, for which the same ...


6

In the definition of beamer@frameslide environment in beamerbaseframe.sty, there is an empty vbox above the frametitle: \ifx\beamer@frametitle\@empty% \setbox\beamer@frametitlebox=\box\voidb@x% \else% \setbox\beamer@frametitlebox=\vbox{ \vbox{}% {\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}% }% \fi% Now assume we remove \...


6

The first answer is already mentioned in the comments. Basic answer is look for the TeX distro's tex/pgf/generic folder. (TikZ/PGF has different implementation details depending on the driver choice so it further classifies code into ConTeXt/Lua/Xe/PDF/La(TeX) etc.) Generic tends to include the driver-independent code. To add yet another option from ...


6

In source2e (or its component ltsect.dtx) you find this documented as \begin{macro}{\@startsection} The |\@startsection{|\meta{name}|}{|\meta{level}|}{|% \meta{indent}|}{|\meta{beforeskip}|}|\\ |{|\meta{afterskip}|}{|\meta{style}|}*[|\meta{altheading}% |]{|\meta{heading}|}| command is the mother of all the user level sectioning commands....


6

In texstudio you can use Ctrl + Left click to open the file directly(*) or right click and then open <your-file-name>.tex. Or from within the pdf right click and Go to Source will also open the file <your-file-name>.tex (if synctex is activated). (*) Thanks to Troy for his comment!


6

In TeX, The Program there is a remark about this (directly after name_of_file is defined): The Pascal-H compiler with which the present version of TEX was prepared has extended the rules of Pascal in a very convenient way. To open file f , we can write reset (f , name , ́/O ́) for input; rewrite (f , name , ́/O ́) for output. The ‘...


5

Here is an approach that combines InftyReader and AbiWord. Suppose we have a file example.pdf First process it with the free version of InftyReader. This will not give the TeX directly (except for the first page) but it will produce a file example.pdf2txt Then you can run AbiWord on this file: abiword --to=tex example.pdf2txt The result is not ...


5

Find fi-logo.mf (https://github.com/liskin/fithesis), copy it to fonts/source and update the FNDB.


5

As I understand it you are asking to insert extra material between the end of the code listing and before the caption. Here is one suggestion for this, providing the new material via an extradescription key to the lstlisting: \documentclass{article} \usepackage{graphicx} \usepackage{listings} \usepackage[hyphens]{url} \makeatletter \def\lst@...


5

Yes, the Pascal reference that Knuth used allows only assignments of strings that have the same length. Strings in Pascal are arrays of base type char with an index type that is a subrange of integers, i.e., 1..n. And, of course, Knuth leaves no bytes unassigned. (That's why the pool_name gets file_name_size characters in your other question.) In section 10 ...


4

Just collect all the else statements together to save on typing and errors, as shown below. Then simply you only need to change one line of the code for the false, i.e., PIECESfalse. \documentclass{article} \usepackage{lipsum} \begin{document} \newif\ifPIECES \PIECEStrue \section{Lorem ipsum dolor} \lipsum[1] \ifPIECES This is small piece. I want this ...


4

Your problem comes in this line from page_style: gobble=4, which is eating four spaces from the start of every line in your code blocks. Quoting from the documentation for the listings package: gobble=⟨number⟩ gobbles ⟨number⟩ characters at the beginning of each environment code line. This key has no effect on \lstinline or \lstinputlisting.


3

XeTeX is the binary, XeLaTeX is a XeTeX format file. While most systems do set up a 'wrapper' executable to allow you to do xelatex, this is essentially the same as xetex "&xelatex". So what you need to do is make the XeLaTeX format, which requires the LaTeX sources (latex.ltx, etc.) plus xelatex.ini, which makes the necessary adjustments to the set up ...


3

A mastersthesis entry accepts a type field: \begin{filecontents*}{\jobname.bib} @mastersthesis{x, author={Me Myself}, title={My thesis}, type={Masterarbeit}, school={That School}, year={2020}, } \end{filecontents*} \documentclass{article} \begin{document} \cite{x} \bibliographystyle{plain} \bibliography{\jobname} \end{document}


3

I actually ponder this question often, and haven't yet (after decades) settled on a single approach that works universally. And as you see from your comments, each coder has their own "style" of indentation. I agree with egreg that it is most important in macro definitions. One method that I have found particularly useful, if you have to break up the ...


3

In your long TeX input file (your source), use \ifsecret ... \fi to sandwich the secret parts that you want to either include or exclude. The common parts will always be included so don't sandwich them. % filename.tex \documentclass[preview,border=12pt]{standalone} \newif\ifsecret \begin{document} common 1 \ifsecret I have a top secret message here. \fi ...


Only top voted, non community-wiki answers of a minimum length are eligible