{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
511 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. ...
10
votes
0answers
93 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
107 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
250 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
58 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
90 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
59 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
38 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
30 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
63 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
80 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
33 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
86 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
98 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
105 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

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
38 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\+ ...
2
votes
0answers
63 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
55 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
39 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
92 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
56 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
56 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
125 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
322 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
133 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
98 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
79 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
39 views

newcommand, section

I just received a new task in LaTex with a predefined structure and predefined commands. There was also the command \mysection. I think it shouldn't show the text of the section in the document, but ...
1
vote
0answers
39 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
35 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
34 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
28 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
61 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
22 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
27 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
40 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
56 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
122 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
56 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
91 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
102 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
198 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
42 views

ComplexTable of Contents

Id like to create a table structure within my document based upon a \newlesson command for example. \newcommand{\newlesson}[1]{ \newpage \addtocounter{LessonNumber}{1}\subsubsection{{Lesson ...
0
votes
0answers
29 views

Lilyglyphs how to design stem

I need to set a new command for drawing a minim with mensural notehead using LilyGlyphs. So far I have made a notehead which is a single character: \documentclass{article} \usepackage{lilyglyphs} ...
0
votes
0answers
30 views

Follow Up Question : multiple lines format for ifthen or ifbool compound statements

Follow up question to How do I add multiple macro definition inside an \ifbool compound statement? Ok if you look at the last post, people fixed my format for the ifthen / ifbool statement format to ...
0
votes
0answers
24 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 ...