{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
195 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 ...
8
votes
0answers
117 views

What type of Chomsky hierarchy is TeX?

There are four types of chomsky hierarchy (specified for formal languages): Type-0 Recursively enumerable Type-1 Context-sensitive Type-2 Context-free Type-3 Regular I consider that, it should ...
6
votes
0answers
418 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 ...
3
votes
0answers
39 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
59 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
187 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
68 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
56 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
127 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
248 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
118 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
24 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
90 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
53 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
43 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
63 views

How to redefine the chapter like the following?

I have a newcommand to redefine chapter. \newcommand{\Chapter}[1]{ \clearpage % \noindent \refstepcounter{chapter} \begin{center} \dsp{CHAPTER\space\thechapter\\} \vspace{10pt} ...
2
votes
0answers
41 views

Different fnmark style in footer and text

I'm using the memoir document class and redefining fnmark like this in my preamble: \documentclass{memoir} \usepackage{footnote} \usepackage[bottom,hang]{footmisc} \usepackage{xcolor} ...
2
votes
0answers
84 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
240 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
82 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
99 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
184 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
79 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
101 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
99 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
33 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
18 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
27 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
30 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
29 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
44 views

defining a new infix command

This question kind of already exists here: How to write infix macro/newcommand? But I'm not looking for a way to divide using an infix command, which I know there already exists a command for. I'm ...
1
vote
0answers
100 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
60 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
39 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
38 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
56 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
39 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
61 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
52 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
66 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
66 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
45 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
51 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 : ...
1
vote
0answers
35 views

Dummy macro for ignoring beamer overlay

I would like a dummy macro that ignores overlay specification (from beamer) when the code is copy-pasted into another class. \documentclass{article} \usepackage{fontspec} \newcommand{\onslide}[1]{} ...
1
vote
0answers
37 views

Can I use Writer2LaTeX and the `mla-paper` style together?

I use LibreOffice 4.1.3.x, and have had success using a patched version of Writer2LaTex with documents created in LibreOffice Writer. I want to create a (sub?)filter for Writer2LaTeX that allows me ...
1
vote
0answers
48 views

Bibtex-like macros organising software

From what I gather (I don't use them, and have never actually managed to get it to work - though this is not my issue), bibtex/biber uses a database of references, alongside an ancillary file created ...
1
vote
0answers
64 views

Is it possible to change the \cite command in the following way?

I know this does not follow very good citation guidelines, but I want to change the cite command so that in addition to whatever the current bib file dictates, it will also print in the name of the ...
1
vote
0answers
64 views

Would I use \catcode, tokens, or look outside of tex for a markdown-like parser solution?

My use case: a LaTeX template for courseware designed in a beamer presentation style. The template I'm designing is company-specific and the specificity of the company's presentation guidelines limits ...
1
vote
0answers
86 views

How to modify some command (like \begin{flalign}) so I can use it as my own

my first post as every beginner starts with question and later on I will give answers :). OK, I am doing my undergraduate work (to become graduate) in Electrical Engineering and I choose LaTeX as ...