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

16
votes
0answers
496 views

A flexible derivative macro with LaTeX3

In an earlier post I asked a question about writing a flexible derivative macro, and someone suggested that a LaTeX3 version might be easier to understand, so I decided to try my hand at writing one. ...
9
votes
0answers
81 views

create list of thumbnails for each section

I want to create a cooking book. There I want to define for each receipe a thumbnail image. At the beginning of each chapter I want to show instead of a TOC a gallery of thumbnails of each subsection ...
8
votes
0answers
91 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 ...
5
votes
0answers
235 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
431 views

Trying to make an automatic histogram (in pgfplots?)

How can I convert the automatic table generated by the macro, to an automatic histogram? Is the best way do it using pgfplots? \documentclass{article} \RequirePackage{ifthen} ...
4
votes
0answers
55 views

Variable Input/Output node using a new command

How can I create a variable input/output node using a new command as in the following picture Say for example, I know that the node will have n inputs and m outputs, which I enter the name as an ...
4
votes
0answers
88 views

Conditionals—do something, if a given command is being used in the document

Is it possible to have a conditional that allow us to do something if a given command is being used in the document? For example for the \part command would be: ...
4
votes
0answers
58 views

xparse with underscore and optional argument

I need a macro which handles its input as follows: \foo A > #2 = A \foo{A} > #2 = A \foo(B) > #3 = A (round brackets) \foo_m A > #1 = m, #2 = A \foo_m{A} > #1 = m, #2 = A \foo_m(B) > #1 = m, #3 = B ...
3
votes
0answers
27 views

Creating a Macro for an n-by-m Matrix in LyX

Specifically, I'd like to create a matrix such as $\left[\begin{array}{cc|c} a_{1} & a_{2} & a_{3}\\ b_{1} & b_{2} & b_{3}\\ c_{1} & c_{2} & c_{3} \end{array}\right]$ But in ...
3
votes
0answers
59 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
71 views

pdflatex: How to automatically quit on compile error?

See also this question on Reddit. I want to automate running pdflatex over and over with make and guard. However, when pdflatex encounters a syntax error, it hangs, preventing guard from being able ...
3
votes
0answers
32 views

Managing collections of shortcut-macros in collaboration projects

I write a lot of very similar documents, and thus make heavy use of shorthands such as % Partial derivative \newcommand{\pder}[2]{ \frac{\partial #1}{\partial #2} } As of now, I have a single file ...
3
votes
0answers
84 views

Replacing text with another one

I need a command to replace the text from left to right given below. for example the command should change ü into \"{u}. I found some command about this but i could't apply. {ü}{\"{u}} {ğ}{\u{g}} ...
3
votes
0answers
97 views

How can I tell which of several solutions to a LaTeX problem is the fastest/most efficient?

Consider this TeX/LaTeX StackExchange question I posted yesterday. I asked for a way to create a particular macro with a somewhat idiosyncratic calling pattern, which is not trivial to code. After ...
3
votes
0answers
102 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
56 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
49 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
29 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
81 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
52 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
53 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
117 views

Problem with overwriting diagram files using feynmf

I've just installed feynmf package and tried working with a standard example. I'm working with MikTeX 2.9 on Windows. The compilation worked fine and I got the diagram in the PDF, but when changing ...
2
votes
0answers
281 views

ProvidesPackage and usepackage

I have seen papers containing a command \ProvidesPackage. Is it different than \usepackage? What is the difference between \ProvidesPackage and \usepackage?
2
votes
0answers
127 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 ...
2
votes
0answers
97 views

problem - multiple index in latex

I find here an example and use it for my multiple index. This code in Latex works, but I want to use the newcommand \smindexxspecial[\ITerm]{beccari} instead \index[\ITerm]{beccari} or ...
2
votes
0answers
76 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} ...
2
votes
0answers
286 views

LaTeX: Beamer with \newcommand

I have tons of slides starting with \bslide I tried to rephrase my source for class Beamer by defining \newcommand{\bslide}{\begin{frame}{xxx}} Unfortunately LaTeX says ...
1
vote
0answers
29 views

What is the meaning of \+ in doxygen-generated latex?

When compiling a software reference manual with doxygen and latex output, I get the following error: ! Undefined control sequence. l.2 ... Modular System for Shelves and Coasts (M\+ ...
1
vote
0answers
36 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
31 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
28 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
20 views

Redefine \question command in exam class to wrap in an environment

I'd like to redefine the question command from the exam class to wrap each question in a new environment. That's the general description. What I'm trying to do is take a document that is written as an ...
1
vote
0answers
52 views

macro: repeat a command if new page else do nothing

QUESTION: How does one write a pair of macros that work in 1) beamer class and 2) article class, respectively, such that if it, \macroname{...}, is executed at a point in the code, that point ...
1
vote
0answers
21 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
26 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
37 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
49 views

How to define pathname variables?

How do I define a variable (pathname) that can be recognized by various commands, such as \input{} and \includegraphics{} ? I tried the following \newcommand{\patha}[]{./folderA} \def \pathb ...
1
vote
0answers
59 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
102 views

Vertical spaces around display math

(First of all, I know that \[ \] should be used instead of $$ $$ and I do it.) I'd like to know about the vertical spacing around math display blocks. According to texdef -t latex \[ we have \[: ...
1
vote
0answers
55 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
82 views

frame in NewDocumentEnvironment

With beamer frames, this does not work. \newenvironment{itemframe}[1]{ \begin{frame}{#1} \begin{itemize} }{ \end{itemize} \end{frame} } Adding fragile, environment=itemframe as an ...
1
vote
0answers
46 views

Shortcut for Variable-Taking Command

I'm working with vectors, which I'm denoting with $\overrightarrow{a}$, where a is just the name of the vector, and thus is a variable that can take any value. I would like to redefine this as ...
1
vote
0answers
77 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 ...
1
vote
0answers
100 views

Abbreviated syntax for CALS package

The cals package allows to create the tables with design capabilities which are available in Microsoft Word. This package is not based on tabular and has more bulky syntax than tabular. I'm try to ...
1
vote
0answers
181 views

Insert code snippet via keyboard shortcut in TeXworks

I know there already are questions (1, 2) on creating keyboard shortcuts in TeXworks. The discussion (also in the Google thread referred to), however, seems a little outdated. By now, there is the ...
0
votes
0answers
24 views

Output command arguments for spellchecking

I have a longer tex file which contains text in different languages. The languages are highlighted in different colors, e.g. {\color{blue} some text in french } {\color{red} some text in ...
0
votes
0answers
40 views

How to create another styling format like \emph

I read how to change \emph and changed it to \DeclareTextFontCommand{\emph}{\bfseries}. Now I want to create another command like \secondstyleformat which I can configure aswell. Such a format could ...
0
votes
0answers
61 views

using macro to simplify the code

I got my code working with net and SO help. But now I want to simplify it using macro. I dont know macro, but people says it makes code more simplified. can some one guide me to have macro for this. ...
0
votes
0answers
26 views

biblatex. comfortable author citing

I'm at the end of writing a text, and I'm not very lucky about the way I had to handle author names so far. I'm using the solution from Citing author's full name in biblatex the first time it ...
0
votes
0answers
33 views

Bold and Italic texts styles are too big

I have a problem with my \textbf and \textit commands, it makes my texts bigger than when no styles are applied. An example is shown here: I also put an URL inside the bold command ...