{tex-core} is for questions that are independent of formats and macro packages. Such questions usually relate to low-level TeX programming or the behaviour of TeX at an underlying level. Note that even Plain TeX is a format in itself; for questions about it, use {plain-tex}.

learn more… | top users | synonyms (1)

0
votes
1answer
13 views

Comma as letter and semicolon as operator in math formulas

Inside document source2e.pdf there are the following two lines \DeclareMathSymbol{,}{\mathpunct}{letters}{"3B} \DeclareMathSymbol{;}{\mathpunct}{operators}{"3B} which treats these two punctuation ...
3
votes
2answers
65 views

Define command to act like \ifvar

I'm trying to manipulate multiple boolean variables which are simply named one, two, three, etc. and since I'm using them with a counter, I have defined some commands to take a numerical input and ...
4
votes
2answers
19 views

How to \show the code of the command \autoref? [duplicate]

Edit: I think this is a duplicate of How can I see the "implementation" of the \LaTeX command? . I wanted to see the code for the hyperref \autoref command, so created this simple document: ...
2
votes
1answer
84 views
+50

Alignment in an enumerate environment using “\hspace” and “\hphantom” commands

I give a display of the first three problems from a multiple-choice test in algebra. The choices in the first problem are displayed using a tabbing environment, and the choices in the second and third ...
14
votes
1answer
116 views

formal syntax rules of \dimexpr \numexpr \glueexpr

After looking at various answers on the site and by looking at the documentation of e-tex, I am still wondering what is exactly allowed in the various types of expressions, i.e. \numexpr, \dimexpr and ...
1
vote
0answers
29 views

Different font style on different OS

I use gnuplot for generating eps-figs including text labels which are organized in a separate .tex-file which in turn I include in my main document. With pdflatex TexNicCenter generates the ...
3
votes
1answer
39 views

Is there any way to read arbitrary part of external tex file?

I am not expert in tex programming, sorry if I am asking a simple question. I need to include an external tex file in a master one but after excluding its preamble and the commands of \begin{document} ...
7
votes
2answers
444 views

Is there a complete modern book which explains how a TeX parser works?

Hi I am reading 'The TEXbook' by Donald E. Knuth. But in my point of view is very didactic for people who want to learn TeX. Most of the pages contain exercises. But many things of how a TeX ...
5
votes
3answers
245 views

macro who argument is proxy of next page break or beginning of a new slide

QUESTION: How do I write macros that run a control sequence \C (for example print a figure on the page or slide, a) right after the next page break (or new slide), or b) right before the next page ...
10
votes
1answer
165 views

Detecting the end of line

Minimal working example: \documentclass{article} \usepackage{color} \newcommand{\mytextcolor}[2]{\textbf{1}\textcolor{#1}{#2}\textbf{2}} \begin{document} This is \mytextcolor{red}{red color} rest of ...
42
votes
4answers
8k views

How to check if a macro value is empty or will not create text with plain TeX conditionals?

I have a macro which holds some text value, e.g. \macro{some text}. If it is empty, I would like for nothing to appear in the document, but it has some content of any kind which would produce text ...
18
votes
3answers
796 views

What is a “Control Sequence”?

When you get an error in LaTeX, the message "Undefined control sequence" is printed. Why is it called "control sequence" and not "command", for example? How does the sequence work? Is this a TeX or ...
1
vote
1answer
24 views

Table changes distance to preceding line depending on rows

This seems to be such a simple issue, but I still have not found an answer to this question. I am using a non-float tabular environment. Depending on how many rows my table has, the distance to the ...
5
votes
1answer
74 views

Segmenting a Bezier curve into equal lengths in tikz/pgf

I'm trying to draw two curves and then create equal sized segments/arcs using pgf/tikz but for some reason the segments are not equally sized. I want to go on and fill each segment with a different ...
12
votes
4answers
324 views

Ratio arithmetic in plain TeX

I would like to calculate the ratio between two dimensions and produce a dimensionless quantity for use in further calculation in the process. I seem to be unable to do so. Specifically, I run into ...
2
votes
0answers
47 views

Where is screed.tex? [closed]

In TeX for the Impatient, Chapter 2, Page 9, it asks to try compiling screed.tex. Where is screed.tex and why did the author not explain what it is?
96
votes
3answers
18k views

What is the difference between \let and \def?

What is the difference between the \let and \def commands in TeX/LaTeX? Ideally please provide a simple example that will illustrate the difference between them.
11
votes
3answers
265 views

Treating the contents of a TeX-style group ({\blah …}) as macro arguments

I am trying to make adjustments to a large document that uses TeX-style macros, like this: {\defun SomeFunctionName arg1 arg2} The \defun macro is defined as \newcommand{\defun}{\tt}. Can I ...
9
votes
3answers
727 views

Detecting \global, \long, \outer, \protected

Is there a way to detect whether or not the next assignment is going to be \global, \long, \outer, or \protected? That is, is it possible to write a command \detectmodifiers such that code like ...
41
votes
2answers
1k views

Can you explain how this code works?

I found this code somewhere on the TeX archives and have been puzzling over it for some time. Can anyone describe how it works? % Date: Thu, 7 Feb 91 12:20:50 -0500 %From: ...
0
votes
0answers
60 views

How to go about learning to program in Tex? [duplicate]

I have been using Tex for a few years now and enjoyed the work of others (e.g., ctan packages, templates, styles). My question sees to practical code to learn from. What would be a good primer, or ...
3
votes
1answer
62 views

TeX expert needed: how to \setto(optimal)width?

there is a problem I have been trying to solve for a while but without success so far. As far as I know, TeX is very good at appropriately breaking text lines with respect to a fixed container width. ...
8
votes
1answer
65 views

Is it possible to adjust the “quantization” of allowable skip lengths?

In plain TeX and derivative formats, the concept of stretchable/shrinkable length, AKA a glue or a skip or a rubber length exists, in general defined as <dimen> plus <stretch-dimen> minus ...
2
votes
0answers
53 views

Rendering text as image to protect e-mail address

I want to protect my e-mail address against spammers by including it as image instead of a (parsable) text. Normally I would have to create the image (with text) by myself and include this as figure. ...
8
votes
5answers
319 views

A more elegant version of the \ifnot macro

A TUGboat article of 15 years ago mentions an \ifnot macro by David Kastrup whose implementation is: \def\ifnot#1{#1\else \expandafter\expandafter\fi \iffalse\iftrue\fi} However, this macro ...
14
votes
2answers
223 views

How can own commands be aware of \global?

When I define a command that defines commands \def\makefoobar{ \def\foo{foo} \def\bar{bar} } and prefix it with \global { \global\makefoobar } it is treated like { \global\def\foo{foo} ...
11
votes
2answers
86 views

split off function for variable as separator

How/Possible to change this implementation of \xSplit so that the separator is a variable filled in at the time of definition (\edef somehow?) or at the actual use of the command?? %based on the ...
7
votes
1answer
109 views

How do counts differ from numexpr

To do basic arithmetic on numbers, one can utilize TeX counts, \newcount\c \c=2 \advance\c 3 \typeout{\the\c} LaTeX counters \newcounter{c} \setcounter{c}{2} \addtocounter{c}{3} \typeout{\thec} ...
1
vote
1answer
48 views

How could I write a Latex tag in source form in section name?

I tried to use \verb|| and \lstinline[language={[LaTeX]TeX}]{} and they failed. I just want to write a name of latex tags in section names for internal purposes. For example, I couldn't compile a ...
36
votes
5answers
5k views

Should I read Donald Knuth's The TeXbook?

I've been using LaTeX for about a year or two as part of writing reports in university and want to gain a more in-depth understanding of how it works (I'm a computer science student). Would Donald ...
8
votes
3answers
259 views

Questions on macro writing in TeX to modify an existing style file: fancybox.sty

I've decided that I must become more adept at TeX if I'm to become proficient with LaTeX. While this is probably obvious to most readers who pass by, my ability to muddle through has hidden this small ...
12
votes
1answer
144 views

Inserting tokens at end of math mode

One can use \everymath and \everydisplay to insert tokens at the beginning of math mode, but what about inserting tokens at end of math mode? Lets say I want to enclose the math mode material in a ...
3
votes
2answers
105 views

Redefining line break (double backslash) for align environment

I am trying to figure out if it is possible to (locally) redefine \\ (double backslash) within amsmath's align environment. On the one hand, I'd like to be able to dynamically insert extra columns, on ...
10
votes
1answer
93 views

assign penalty to one discretionary (not all paragraph)

For a quite complex problem that would be too long to describe, I need to set different penalties for different discretionaries in the same paragraphe. It doesn't seem to be possible with pdfTeX (and ...
31
votes
1answer
1k views

What do different \fontdimen<num> mean

I know that \fontdimen<num> returns some dimensions associated with the current font. What are they?
11
votes
5answers
468 views

Basics of scanning

I'm trying to master the art of scanning text one character at a time. The following is what I've discovered so far. Is this as good as it gets? I would really prefer not to do all those \edefs as ...
3
votes
1answer
76 views

How to avoid typesetting any cell if a table is empty

Following How can I define a macro that adds a row to a table that has not yet been printed?, I came up with a macro (\AddToTable) that “builds” a table, i.e. appends its argument as the last row of ...
0
votes
0answers
19 views

widesplit macro explanation [duplicate]

Could you please explain how this macro function ? \def\widesplit#1{% \cleardoublepage \def\row##1##2{##1}% #1% \clearpage \def\row##1##2{##2}% #1% \clearpage } OK, some things are clear to me. def ...
25
votes
5answers
794 views

Most efficient way to reverse a token list (tail recursion)

Goal: reverse a list of characters, going from \def\mylist{abcdefgh} to \def\mylist{hgfedcba}. This is easy using a marker which does not appear in the list, such as \relax: \def\mylist{abcdefgh} ...
8
votes
3answers
111 views

Appending active and expansion sensitive characters to a macro

This question comes up pretty often when people want to build tables with empty columns or similarly building up some active characters inside a macro hoping to expand them at the right time right ...
25
votes
4answers
1k views

Display hyphenation options for a specific word

When TeX produces Overfull box, is puts something like this in the log: Overfull \hbox (15.47195pt too wide) in paragraph at lines 7--9 []\OT1/cmr/m/n/10 I re-ally re-ally want to get dis-played the ...
3
votes
2answers
523 views

how do you put caption on figures in sweave

I have this sweave code. I need to add caption to the figures. I am doing this but it looks like I see the figure before the section{Data ANALYSIS}: \documentclass[letter,12pt]{article} ...
19
votes
2answers
410 views

\expandafter and \aftergroup: where do the 2n+1 and n^2-1 rules come from?

Both TeX primitives \expandafter and \aftergroup have "rules of thumb" stating that \expandafter should be used 2n+1 times to look n tokens ahead (is this correct?). A similar "rule of thumb" holds ...
12
votes
3answers
600 views

How could the macro xii.tex be simplified into a better readable form

I was reading some TeX guides from where I have found this source: \let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP ...
43
votes
3answers
66k views

Escape character in LaTeX

I need to output the below text but since \ is a special character, I cannot: [RegularExpression(@"\d+")] Also sometimes I need use dollar sign $ as well but it seems to be a special char, too. ...
1
vote
0answers
88 views

Memory overload due to pgfplots / tikz

first of all, I need to mention that there are 2 related threads, that I found usefull: 1, 2. I am working with TeXstudio 2.8.8 on Win 7 64bit (i5 @3.3GHz, 8GB RAM - if this matters). My goal is to ...
89
votes
7answers
23k views

What is the difference between TeX and LaTeX?

I know LaTeX and I've heard that LaTeX is a set of macros in TeX. But what does it exactly mean?
1
vote
1answer
56 views

Passing values from PythonTeX to LaTeX

I have read in the PythonTeX manual about how to pass LaTeX values to PythonTeX, but I cannot find any documentation (or a way) to do the reverse. For example, in the LaTeX package datenumber, one ...
3
votes
1answer
49 views

Specifying coordinates with \def in PSTricks

I'm starting with PSTricks. I use the following macro to set cartesian coordinates: \def\newPoint#1(#2,#3) { \expandafter\def\csname x#1\endcsname{#2} \expandafter\def\csname ...
151
votes
23answers
7k views

Are there any open research problems in the world of TeX?

For a year-long capstone project in computer science, I have to do some 'original research.' I'm still not entirely sure what this entails, but it just struck me that perhaps I can do research and ...