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

0
votes
0answers
10 views

Expansion Issues When Passing TikZ Styles to Macro Created by Macro

I'm struggling (again) with expansions. This time I have a generic function \misdirection that creates a TikZ environment subject to a few options. Then, I create a macro \freezeStyle that creates a ...
3
votes
3answers
97 views

Processing Plain Text

I'm currently trying to typeset a plain text file that has a certain structure. There's one thing that I can't get working, and that is the following. My plain text is structures as follows: "lorem ...
1
vote
1answer
24 views

I cannot run texnic centre on my miktex

When I try to run latex.exe on my document, the following shows up: C:\Program Files (x86)\MiKTeX 2.90\miktex\bin\latex.exe Cannot execute the command. Error:The system cannot find the file ...
0
votes
1answer
33 views

Bold or arrow vectors with new command

Im quite new to latex, I would like to make either bold or arrow vectors. I found many solutions to this but i cant see where i am doing it wrong, my code is \documentclass[a4paper,11pt]{report} ...
6
votes
2answers
90 views

Reuse command portion in LaTeX

I defined several new code environments (using listings' lstnewenvironment); they all share the same attributes except one (the language used). For example: \documentclass[a4paper,12pt]{book} ...
2
votes
1answer
18 views

Using \snoc as macro name inside mathpar

I'm able to define a macro called \snoc but unable to use it inside a mathpar environment: \documentclass{article} \usepackage{mathpartir} \newcommand{\snoc}{hi} \begin{document} \begin{mathpar} ...
0
votes
0answers
11 views

how to use \savesymbol for the bibliography?

My bibliography contains, among others, several words in polutonikogreek. I haven't found a better way than to use the polutoniko-macros from teubner. As some other package redefines the macro \aa ...
3
votes
1answer
41 views

Opening and closing brackets in combination with the ifthen package

Related to this question, however, I was not able to solve my problem. Let me give some background. I want to switch between the article style and a specific journal style. The journal style has ...
5
votes
1answer
129 views

I want to include a closing bracket } in a \newcommand definition

I want to use the closing bracket in a \newcommand definition. I can give more explanation as to why, but this seems unnecessary at the moment. Obviously the MWE does not work, but how to make this ...
2
votes
2answers
46 views

Passing the value of a register as a macro argument

I'm looking for a solution to the following problem: \def\m#1{{ \dimen0=200pt \#1=\the#1 % Outputs 200pt rather than 100pt }} \dimen0=100pt \m{\dimen0} EDIT: The code sample above ...
4
votes
3answers
198 views

Macros that write macros and unexpected side effects

I'm having some trouble fixing a macro I wrote. I believe that it has to do with \let, \def, and \edef. I have gone through: What is the difference between \let and \edef? but I still can't seem to ...
2
votes
1answer
49 views

Can't use command with square brackets in matrix environment

I've defined a command that uses square brackets, and when I use it within a matrix environment, the command is not parsed. I stumbled upon a solution to my problem here: "[" Square bracket ...
1
vote
1answer
35 views

How to renew the \rightarrow command?

I am playing and exploring the renewcommand and newcommand right now, and I tried to do: \renewcommand{\rightarrow}{\mathlarger{\mathlarger{\rightarrow}}} I get it to work with the newcommand like ...
2
votes
0answers
34 views

How to define a macro which does not read the next token after itself? [duplicate]

In LaTeX, I would like to define \newcommand{\ACROeg}{e.\,g.} This is a sample sentence, \ACROeg it does not make much sense. but this yields This is a sample sentence, e.\,g.it does not make ...
1
vote
0answers
41 views

Passing a command as an argument

I got a solution for my quoestion about Smaller roofs for forest but I want to pass a command instead of text to a procedure and this causes an error: ! Argument of \@rsbox has an extra }. ...
5
votes
4answers
111 views

Defining a macro a variable number of arguments

I want to define a macro that defines a series of other macros, each of which takes a variable (but in any given document fixed) number of arguments. I know that I can do this using something like ...
3
votes
0answers
35 views

Detecting currently running executable - and usage of Latex?

Somewhat in the similar vein as Getting Texlive version in pdflatex?, now I want to obtain the currently running executable inside a *tex run. Thanks to Write18: capturing shell (script) output as ...
0
votes
0answers
51 views

Wolfram Mathematica Functions in Lyx

Can I use all functions of mathematica in Lyx? I want to use functions like Solve[]
2
votes
3answers
47 views

Concatenating commands with arguments in a macro?

I want to read some lines from a text file, wrap a "style" which in this case is \texttt around each line, and as such concatenate it to a macro that I can use in the document. I came up with this ...
3
votes
2answers
34 views

Outputting/typesetting the names of (first-level) packages used in a document?

Consider this MWE, test-0.tex: \documentclass{article} \usepackage{filecontents} % tlmgr install filecontents \usepackage[utf8x]{inputenc} \begin{filecontents}{test-1.tex} \usepackage{tikz} ...
4
votes
2answers
97 views

How to add source information at bottom right corner of a figure in beamer?

I am inserting several figures into my beamer presentation that I did not create myself. Therefore I would like to add some source information with just a command, e.g. ...
1
vote
1answer
81 views

How to add \thanklessauthor to a KOMA Script document?

Well I'm working with a document in KOMA Script and I tried to use the \thanklessauthor command that I found in the code of the Sample book of Tufte-book class. First I thought it was a plain TeX ...
3
votes
1answer
71 views

Defining custom direct and inverse limits

I would like to define custom direct (a/k/a inductive) and inverse (a/k/a projective) limits, as used in category theory, for example. (Not the limit as used in calculus.) In other words, I'm looking ...
1
vote
1answer
23 views

\newcommand Error Either Way [closed]

I have two documents, both starting with \documentclass{article} \usepackage{Macros} \begin{document} where Macros is my own style file. There are no other packages or definitions in either of the ...
3
votes
0answers
49 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 ...
4
votes
1answer
25 views

Macro with optional arguments into arguments of another macro

I just want to pass as an optional argument, a macro with an optional argument. If you look at the minimal exampel below, if I use [scale=1] in the optional arguement of the new macro it does not ...
4
votes
2answers
134 views

New primitives and grammar for replacing horrible \expandafter

Time and time when I am trying to read or write some macros, I'm always frustrated by lots of \expandafters inside them. Why don't we add some new primitives and grammar into TeX engines to make ...
2
votes
1answer
50 views

How can I add title like command?

I am making a poster where I edited an existing style \setbeamertemplate{headline}{ \vskip4.5cm \hskip14cm \mbox{% \begin{minipage}[r][][c]{\dimexpr\textwidth-15cm\relax} ...
12
votes
6answers
730 views

Show only two year digits

How can I insert two digit year string? I know that the command \the\year inserts four digit year string. I tried using \twodigit\year, but it also returns four digits. I guess I need some kind of ...
0
votes
0answers
82 views

Gear or cogwheel tikz graphic

I found the code that permits the design of a gear. But what I want is to be able to Control the distance between teeth so I can increase their numbers. Fill each tooth with different colour. Be ...
4
votes
3answers
74 views

Print a macro I created in a package

Based on the answer I received to Print a short title in the header, I've created the macro \handoutheader in a .sty file I use as the template for my conference presentations. ...
0
votes
0answers
20 views

Custom sectioning below subsubsection : generic macro ? [duplicate]

I would like a to create a custom sectioning, the depth of which can be... very large. I am currently using this macro to create the subsubsubsection environment. \makeatletter \newcounter ...
7
votes
2answers
144 views

What internal command(s) does \hspace call?

I know that (by \hspace vs. \hspace*) the command \hspace* calls the internal commands \vrule width 0pt \nobreak \hskip 1cm \hskip 0pt plus 0pt minus 0pt but which command(s) does \hspace use? Is ...
13
votes
2answers
152 views

ifx, macros and grouping

I do not understand how \ifx interacts with macro definitions. Here is a minimal example: \def\a#1{\b} \def\b#1#2{[#1:#2]} \a ABC The output is [B:C], as expected. If I change the definition of \a ...
0
votes
0answers
22 views

Multiple references with letter

I want to group the range of references together with letter of the alphabet (i.e. [A.1-A.5] instead [A.1][A.2][A.3] or [A.1, A.2, A.3] and I know that I should use \usepackage{cite} for it. Documment ...
4
votes
1answer
38 views

Unescape command parameter

I'm using docutils to generate LaTeX files, with custom roles for using latex specific commands in the rst files. My problem is, that docutils automatically escapes underscores in the parameters of ...
2
votes
1answer
50 views

How to reuse common data elements for multiple macros?

I want to use macros to present different combinations of data elements from the same data set more than once in the same document. For example, it is easy to summarize the elements from Data Set A ...
6
votes
1answer
58 views

Customizing enumerated lists with tikz prints enumi instead of number

I'm trying to make an enumerate list that has the numbers inside a colored circle. For the circles I'm using the tikz package and the color package. I define a circle in the preamble and then I ...
3
votes
1answer
57 views

Macro that checks for the beginning of a line

How can I add a new command that differentiates between the first word of a line, and any other case? For example, the macro \etc for printing "etcetera" if its the beginning of the line, otherwise, ...
5
votes
1answer
28 views

How to create new accented character in mathmode that works with superscripts and under scripts

I'm trying to write a macro that would yield in math mode the placement of a character (for example, *) above a variable (here, x) with superscripts (^) and underscripts (_) similar to what LaTeX does ...
6
votes
1answer
151 views

custom hatching pattern : arbitrary direction of hatching

For a kind of mathematical illustration, consider the case where several distinguishable hatchings, all black and white, and precise direction has meaning, are required. I give a simple example of a ...
2
votes
2answers
94 views

“Undefined Control Sequence” error despite \newcommand definition!

I have installed texlive full package: I use TeXmaker and this is a code where I want to draw a grid as in tikzpicture. I want to just call the \gridkar function defined below. So I defined it in ...
3
votes
2answers
39 views

Compiler Error when Creating a Macro/Environment

I'm trying to create a new command or environment or something to format what is essentially a section, but it needs to have it's own counter. I would like to not use any of the \section \subsection ...
5
votes
1answer
52 views

Problem with underscores in \newcommand

I am currently writing my thesis and I have each chapter as a separate project- I've been told I should join them up but I don't want to for now as I would find it overwhelming. I'd like to be able to ...
1
vote
3answers
108 views

Parse csv-list, function with >1 parameters as callback

In my texts I have to deal with lists, whose items need to be formatted seperatly, i.e.: \funktion[3][]{T}--\funktion{S}--\funktion[3][7]{D}--\funktion{T} In \funktion which leads to \emphsubsup the ...
6
votes
1answer
117 views

Defining a new command works selectively

I have just created a new command that will print text in bold and blue using the following syntax \newcommand{\blue}[1]{\color{LHCblue}{\textbf{#1}}} My full code is ...
1
vote
1answer
65 views

“Theres no line here to end” in custom command

I am working on creating a resume in LaTeX and have defined a command that allows me to input my work experience. The only problem is that whenever I try to use an itemized list, as seen below, I get ...
4
votes
2answers
51 views

Using forcsvlist with macros that take more than one argument

I'd like to compact this code sample with \forcsvlist (provided by the etoolbox package). \newcommand\mycmd[2]{ \pagestyle{#2} \csname tit#1\endcsname \cleardoublepage } \def\DOtitlepages{ ...
3
votes
3answers
72 views

\input{} as argument for \inputgraphic{}

I got a question very similar to this post (\includegraphics{\input{|shell command}}) which unfortunately hasn't been really answered. The aim is to make a command that invokes a python script to ...
4
votes
2answers
64 views

Add content from an external file to the input tokens for parsing

I have a possibly very long sequence of tokens which is parsed by a macro. I would like to be able to read parts of this sequence from external files, if this is possible. I made up an MWE for this ...