{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)

10
votes
0answers
114 views

Determine File Name and Line Number Where a Macro is Invoked From

Wondering if there is any way to print out (for debugging purposes) the file name and the line number from where a macro is invoked (not where it is defined). My attempt to use the currfile package ...
10
votes
0answers
216 views

How to pass a LaTeX argument verbatim to lua?

I would like to pass an argument verbatim from LaTeX to lua including LaTeX commands and end of line characters. The example below takes care of the former issue, but not of the latter. Is there a ...
9
votes
0answers
457 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 ...
4
votes
0answers
40 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
55 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
31 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 ...
3
votes
0answers
23 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
50 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
67 views

endfloat and \newcommand incompatibility

I have a lot of figures and tables defined using \newcommand{\NAMEOFTABLE}{\begin{table}...\end{table}} and I would like to use them with endfloat package. Here is a MWE that demonstrates the ...
3
votes
0answers
217 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
71 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
58 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
153 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
272 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
121 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
27 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
40 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
29 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
104 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
57 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
47 views

Automatically return list of all uses of a command, without repeats e.g. \compound using chemstyle

I'd like to automatically generate a comma separated list of all occurrences in my .tex file of a particular command. Specifically, I want to ensure the correct numbering of chemical structures using ...
2
votes
0answers
86 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
273 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 ...
2
votes
0answers
87 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
107 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 ...
2
votes
0answers
211 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
83 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
106 views

tikz command fails after .cls file change

The following tex content is a part a tex file which is added to main file with command input. With a new .cls and some other unrelated changes, tex isn't compiling with error message of ! Package ...
2
votes
0answers
106 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
18 views

Fraction macro in lyx

I want to create a macro for word-like fraction sign in lyx. Namely, when I write 1/2 I want it to be \frac{1}{2} Any Ideas?
1
vote
0answers
24 views

Expanding to something missing an argument

I have a very weird behaviour where replacing something by its extension removes an error. Here's the problem: \documentclass{article} \usepackage{xparse} \usepackage{mathpartir}% ...
1
vote
0answers
37 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 ...
1
vote
0answers
25 views

Consistent formatting for \glft in expex

In the ExPeX documentation, all of the examples with \glft wrap the glos with single quotes; the examples in my document look the same: \pex \begingl \gla bu nɛmə // \glb this what // \glft `What's ...
1
vote
0answers
77 views

Writing modular classes

As an OOP programmer, I am very attracted to the idea of making separate files for independent features within a class definition, where each feature I feel is too long to be included inline in the ...
1
vote
0answers
31 views

Passing background color to \lstinputlisting

In question Passing parameter in presence of an xkeyval value I received two ideas for dealing with passing an option to a macro. Namely, \expandafter\lstset\expandafter{\ME@options} and ...
1
vote
0answers
36 views

How to split a string to figure float with figure name, label and caption?

I am struggling with a shorthand macro that converts a string to a figure. At the end is a working, but unstable version what I am trying to do. The goal is to parse make a command (or macro) like ...
1
vote
0answers
39 views

How to include input filename in error message?

I want to add an error message to a class I'm building for when the user (which will generally be me...) forgets or messes up a macro call sequence. I can do this: ...
1
vote
0answers
114 views

Failure After Using Latexdiff Script: latexdiff marking up lstlisting environment

After running a script to use latexdiff on a multiple input latex file I am left with a diff.tex file that is generating the following error: ./diff.tex:7009: LaTeX Error: \begin{description} on ...
1
vote
0answers
75 views

Macro passing problem with pgfmath

As a continuation of thread 2010/2014 versions difference: I am trying to decorate program listings with highlighted lines, numbered balls, etc. In 2010, I used a macro which does not work any more ...
1
vote
0answers
43 views

How to define a simple command for “mark” in an exam paper?

Here is the link for a .cls file. http://phyweb.phys.soton.ac.uk/ugadmin/Staff%20forms/EXAM%20TEMPLATES/su-exam.cls But all I want, is to be able to use \mark. And being able to get a simple total ...
1
vote
0answers
39 views

pgfplots(table) protect ##1 when in a `\newcommand` with optional arguments

I am using the excellent answer from @percusse to the question How to rotate head row cell entries of pgfplotstable which works great if you always want rotated headers. I am calling ...
1
vote
0answers
48 views

Write a class with different code for different version

I want to write a report-like class (maybe based on KOMA-Script). My problem is that the layout will be evolving and maybe the features of the package to. I would like to know if there is an easy way ...
1
vote
0answers
61 views

Is it possible to use `renewcommand` to replace the `hyperref` command with `hyperlink`?

I am using Beamer with Hyperref, and I have a problem with the \hyperref command. The link is active, but it sends me to the first slide of the talk. I've read here in the Troubleshooting section ...
1
vote
0answers
40 views

Preprocessing code for cross-compilation of two different projects?

I have two different projects, which are the LaTeX code for English and Greek for the same book. Does LaTeX support preprocessing code (without using any external tools) that would allow two ...
1
vote
0answers
73 views

Problem with answers using hyperlinks and tbox

I have minor problems with the solutions shown in Hyperlink with answers package I wanted to make a macro which takes solution and exercise as arguments, uses a button like mutual reference, and ...
1
vote
0answers
66 views

macro for glossaries counter

I want custom my glossaries, and specially I want to have something like My glossary entry, its signification (see p. 1), if this entry mentioned only once or My glossary entry, its signification ...
1
vote
0answers
72 views

How do I make a new command with author/journal/year citation in footnote

\documentclass{beamer} \usepackage[backend=bibtex]{biblatex}%backend=biber, natbib=true, style=chem-acs \bibliography{oralspaper} \DeclareCiteCommand{\citejournal}%%%creating \citejournal command ...
1
vote
0answers
69 views

indexing with sed using less brittle \gls and \acs and \index commands

I'm writing a book for which I produce sections for glossaries, acronyms and index entries using the glossaries, acronym and makeidx packages on a template derived from the Springer book template. To ...
1
vote
0answers
51 views

Bind command to command output

How can I bind the command to the output of another command, determined at the time the command is bound? For example with the following code, \newcommand{\hello}{foo} \newcommand{\world}{\hello} ...
1
vote
0answers
55 views

using macro to identify “line breaks” as properties separator, “:” colon as properties name separator, and “-” hyphen as description

Here I have created document as per requirement. But I need to use macro in specific way. Here is my document : ...