{macros} is for questions specifically concerning TeX's macro processor. Note that, because TeX uses macros ubiquitously, most questions about code that uses macros are not looking for information about how macros work, and so are not appropriate for this tag.

learn more… | top users | synonyms (4)

15
votes
0answers
119 views

Is there a reliable way to get the number of arguments of a command?

While pondering over a test to distinguish two versions of a command I came up with the following example: \documentclass{article} \begin{document} \def\testA#1{\#2->blabla} ...
11
votes
0answers
625 views

Copy to clipboard feature in PDF output

I want a clickable copy to clipboard feature in my PDF document. Ideally the macro also allows for graphical elements to be embedded inside them (say, a button that will automatically copy paste ...
5
votes
0answers
17 views

Problem between keys, paths with two macros and pgfkeys

Sorry the code below for my minimal example is a bit long. In this code I defined two macros : the first macro \SC draws semi-circle and the second macro \ARC draws arcs. The first macro uses the ...
4
votes
0answers
70 views

Getting negative vspace to behave

My TeX code (including parameters in command definitions) that creates lyrics sheets and chord sheets of songs is generated dynamically by other code accessing database data and processing it line by ...
4
votes
0answers
55 views

$\widehat$ prints a reverse paranthesis whenever argument length >5

I am using Babel Greek and the following code for my doc: \documentclass[titlepage]{book} \usepackage[vcentering,dvips,hmarginratio=1:1]{geometry} \geometry{ papersize={210mm,280mm}, ...
4
votes
0answers
60 views

Strings and memory usage

The TeX engine was originally written in Pascal before dynamic memory allocation was generally available. Modern implementations tend to be done in C. To qualify as TeX an implementation has to pass a ...
4
votes
0answers
45 views

standalone package and user-defined macros/lengths

This is my first post on this amazing website, so hi to everybody!! I'd like to know if there is a way to pass some parametrs (macros or lengths) to a standalone file. Here is my MWE: Consider the ...
4
votes
0answers
344 views

Automatic dropcaps for the first letter of a chapter

I'm in the process of writing a LaTeX style for thesis dissertations, and would like to automatically transform the first word of a chapter to dropcaps. This is trivial to do manually using the ...
3
votes
0answers
143 views

TeX/LaTeX macro to find out where am I in a tabular

Do you know a macro/command which can tell me where was it called in a tabular environment? Specially, i wish a macro which executes \commandA if I called it in the first cell of a row (or after a \\ ...
3
votes
0answers
29 views

Can I force a pre-process action on all commands or environments without having to redefine them all manually?

I am trying to preserve a history of the latex commands and environment initializations I use in a typeset html or pdf file. Is there a way where I can force a pre-process action on all commands ...
3
votes
0answers
75 views

mouse over (highlight) acronyms using acronym package. is that possible?

Is it possible to highlight acronyms (mouse over shows the acronym definition) by using the acronym package \ac ....? In this post, there is a macro that was working somehow but by using the acro ...
3
votes
0answers
85 views

Retrieving coordinates of every character in a formula

I'm writing a program that uses LaTeX to display formula's. The user must be allowed to click on different parts of the formula, and the program should know on which part the user clicked. Is there ...
3
votes
0answers
62 views

A mysterious blank line come from an \hskip?

I use a very complicated .sty file. The main purpose of this .sty is to enable a special inline box in which texts can be typeset in a very special way. There is no problem inside the box. The .sty ...
3
votes
0answers
411 views

Passing an array type argument for new command

I've looked around and can't seem to find anywhere, but I was wondering if there is somewhere you can do something like the following: \newcommand{\loopy}[1]{ \begin{tikzpicture} \foreach ...
3
votes
0answers
250 views

looking for selective latex command replacement methods

I have a perl script for generating wordpress (or physicsforums or wikipedia) style latex markup from standalone latex files, but it has grown into a bit of a monstrosity and has also recently met ...
3
votes
0answers
179 views

Duplicate Line command in TeXShop for Mac

I'm a quite new user of LaTeX and one thing I miss in TeXShop on mac is a "Duplicate Line"-command, espacially when writing mathematical derivations. It's my impression that it is possible to create a ...
3
votes
0answers
358 views

Using the correct amount of space around unit symbols

This is from an old package I developed back in 2003. The idea was to cover international system units (SI) and other type of units, roughly following guidelines from that document. Units should ...
3
votes
0answers
124 views

A problem with using the \ganttbar macros inside another one

I'm trying to write a macros for converting day time to a format, which the pgfgrantt package can understand. Here it is: \newcommand{\htime}[2][0]{ \StrBefore{#2}{:}[\hours] ...
2
votes
0answers
51 views

Automatic lettrine in chapters

I'm trying to get lettrine dropcaps applied automatically on the first word of each chapter. I found some code here: http://dererumnatura.us/archives/2009/02/automatic-usage.html which I've tried ...
2
votes
0answers
38 views

Basic definition of variables for use in resume

I'm working on writing my resume in a LaTeX and hoping to implement some commands to automate section styles (though I am by no means planning to write an entire class). For example, I'd like to ...
2
votes
0answers
38 views

Trouble with frame in newcommand

I'm making a slideshow with LaTeX beamer class like this : \documentclass[xcolor=dvipsnames]{beamer} \usepackage[french]{babel} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} ...
2
votes
0answers
42 views

Macro with \afterassignment syntax?

Say for some reason I want to make a macro with input stream behaviour mimicking that of \afterassignment and \aftergroup. Namely, I want to absorb exactly one token from the input stream following ...
2
votes
0answers
48 views

Ignore special characters in \newcommand argument to generate section labels?

I am editing a rather large document and have replaced \section, \subsection etc with \newcommand macros that include \section etc but also spacing and other commands. I am trying to get it to ...
2
votes
0answers
68 views

A \newcommand type option that runs all subarguments and saves static text

I am trying to write code that uses sage in it, and have a bit of a problem with randomizing stuff around the code. The sagetex part isn't too important (I don't think), what is important is that if I ...
2
votes
0answers
56 views

Spoilers in Web-Accessible Pdf Documents?

A highly regarded professor of mine is currently writing a graduate mathematics textbook in which he has given the book a theme of ``do it yourself'' mathematics. He has asked me to review the book ...
2
votes
0answers
156 views

How can I migrate commands and environments from LaTeX2e to LaTeX3? [XeTeX]

Sometimes forcing consistency makes things much easier to maintain. The motto "keep it simple" comes to mind. xparse offers the most bang for your buck when it comes to defining commands with various ...
2
votes
0answers
74 views

Unwanted vertical space at top of page before subsection heading

I have been using LaTeX for a while now, but I am very new to defining my own commands in the preamble. I am working on my thesis, and I'm using a custom .cls file which has been passed down by other ...
2
votes
0answers
53 views

Defining and expanding macros In loops

I want to define and expand macros in a \foreach loop. The names of the macros depend on the iteration step. The macros I define are interpreted as strings rather than sets of numbers that I actually ...
2
votes
0answers
42 views

Adding default \skew to math accents

Out of corporate design reasons I should use Helvetica for my documents. I could simply ignore this, as most people do ;-) But out of fun I just combined ideas taken from sfmath and beamer to make ...
2
votes
0answers
67 views

Autocomplete in TeXstudio for macro with optional argument

I have a macro, such as \newcommand*{\example}[2][]{#1.#2} defined. TeXstudio adds this to its autocomplete list, which is great, but when I actually autocomplete it shows up as ...
2
votes
0answers
70 views

How to create command to make custom Indicator Function

So, I've found this package for common probability items in LaTeX and the very last entry is a "customizable" indicator function in which one simply inputs the variable (e.g. x) and it returns ...
2
votes
0answers
53 views

Display shortcuts other than urls with href

Big picture, I am trying to develop an approach that will allow me to store the latex commands and labels (pre-expansion) that I use to typeset dynamic text (bib entries with cite, cross referencing ...
2
votes
0answers
56 views

Typeset code within a simple macro?

I want to use a macro to typeset programming code with the usual characteristics (particularly lines should be obeyed - this is the most important issue; highlighting and such stuff is - for now - not ...
2
votes
0answers
51 views

\ifbeamer@anotherslide and \ifbeamer@localanotherslide in beamerbasedecode.sty

At the beginning of the source file beamerbasedecode.sty of beamer class, two switches are defined: \newif\ifbeamer@anotherslide \newif\ifbeamer@localanotherslide By reading beamerbasedecode.sty ...
2
votes
0answers
173 views

soul for text highlighting, microtype for letterspacing, and xspace: incompatibility

I am trying to use soul for highlighting text and microtype for letter spacing (and other things). But I cannot get the two to work together nicely when I include xspace (I use this mainly for ...
2
votes
0answers
69 views

Correct way to make command defined in tikzpicture environment (in an example) available in all documents?

The wonderful answer to the question Easy curves in TikZ shares some code that is defined inside a tikzpicture environment. I share the relevant portion of the answer here: Here is a slightly ...
2
votes
0answers
97 views

Generating LaTeX reports from XML *without* external scripts

First of all, I apologize if this is pretty similiar in nature to my previous question: Reading and (custom) formatting a CSV (not \csvautotabular) I thought it would be better to separate the two ...
2
votes
0answers
111 views

Different colours for each argument and value in listings

This recent question (Print blue brackets in one language and black in another) made me come up with (up to) two more questions regarding the listings package: Is there an option similar to opstyle ...
2
votes
0answers
306 views

fancyvrb inline verbatim with \newcommand and \CustomVerbatimCommand

I've just registered. This is my first question to this site. I am trying to make a verbatim command for inline code. This has been asked and answered many times before, but I never found a direct ...
2
votes
0answers
92 views

\ref to \label in other document?

I have a repository with one document, but I think of splitting it into two documents, whereas I want to cross-reference from one to eachother. Is there a way, to "rewrite" \ref to automatically ...
2
votes
0answers
116 views

Create all queries in separate file like \listoffigure

I would like to print all the queries collect from the article and need to print in article opener page. How do achieve this? My MWE: \documentclass{threecolumn} \begin{document} \jnltype{37} ...
1
vote
0answers
50 views

Where to put plain TeX macros so MiKTeX finds them

I have MiKTeX 2.9 working except it can't find the files (.tex macros) when the source file (always plain TeX) refers to them as in \input mac2 I do have a TDS-compliant directory called ...
1
vote
0answers
33 views

Package that fills pages to total number of pages devideable by 4, 8, 16

I'm doing a package right now, which is capable of filling in empty or custom pages to get a total number of pages which is devideable by a defined number. I just want to make sure, that a package ...
1
vote
0answers
51 views

Macro: Replace all occurrences of words which are identical to content of \label{…} into \nameref{…} (unless of course the \label itself)

This question is a follow-up of Macro: Replace all occurrences of a word, but would like to ask for a possibility to do the same with words (e.g. foo) that are identical to the contents of certain or ...
1
vote
0answers
25 views

Why does having an empty definition, {}, when defining a new command execute whatever is between the brackets when the command is called?

Here is an MWE: \documentclass{article} \newcommand{\new}{} \begin{document} \new{Why is this printed?} \end{document} Which outputs a document that says "Why is this printed?". My main question ...
1
vote
0answers
64 views

Using /csname in

I want to use a smarter solution for a big CSV file with many LocalX columns \documentclass[a4paper,12pt,hidelinks]{article} \usepackage[utf8]{inputenc} %\usepackage[utf8x]{inputenc} ...
1
vote
0answers
72 views

Terminate and Start and environment from within the environment

How can I terminate and resume an environment by another environment? This also seems to have broken the resume feature which was resolved in Define a List that is Always Resumed. The code ...
1
vote
0answers
53 views

New commands suppress other commands

I adapted the new commands wrote by @Alan Munn, to produce LaTex representation for some African language symbols. However, the new commands seem to suppress the use of other symbols, which worked ...
1
vote
0answers
66 views

Problem with microtype's `\textls` and math mode

I have some issues with classicthesis' \spacedlowsmallcaps command that I could bring down to the following MWE: \documentclass{scrartcl} \usepackage{microtype} ...
1
vote
0answers
40 views

xparse verbatim argument removing multiple space

I am trying to define a command, using xparse that take as input some verbatim code and cite it using listing. However, the eventual multiple white spaces or tabulations at the beginning of a lines ...