Questions tagged [macros]

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

181 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
61 views

How to dynamically generate function argument signatures using custom API in LaTeX3

In trying to learn more about the details of what is possible with LaTeX, I wanted to see if I could create an API around creating functions. This is what the output function would be, for example: \...
0
votes
0answers
37 views

(Framed) environment blank spaces

Could be a very beginner question, but still. Considering the following: \usepackage{framed} \usepackage{tikz} \usepackage{listings} ... \newcommand{\some}{\textcolor{red}{\lstinline{some}}} \...
0
votes
1answer
177 views

Gnuplottex: Pass latex command to gnuplot script

I want to access and plot the same data from different LaTeX documents (a paper and a beamer presentation) using gnuplottex. The data and the gnuplot script is stored at some individual position ...
0
votes
0answers
64 views

The macros I previously defined no longer seems to work (Tex Studio)

I am using Tex Live and Tex studio. The macros I defined months ago and which were working just fine until this morning seem no longer be working. The macros appear in a pink box and the document ...
0
votes
0answers
58 views

How to Make a newcommand to Give Different Outputs for Displayed Math or Inline Math?

Does any one know how to make a single simple command that gives different outputs for displayed and inline maths \documentclass{article} \usepackage{amsmath} \begin{document} $A^\prime$ \begin{...
0
votes
0answers
48 views

Redefining subsubsection

In book class, subsubsections induce huge spacing before and after and makes the structure too empty for my taste. Hence I would like to redefine it in order to get the one present in amsart for ...
0
votes
0answers
99 views

newcommand in math mode error

I am making a presentation and I need to use the following expression quite a lot, so I made the following new command \newcommand{\extreig}[1][\lambda]{\ensuremath{{#1}_{\mbox{{\footnotesize extr}}}...
0
votes
0answers
53 views

Spot commands in the layout file

I'm searching for a way to highlight some commands in the layout file. I need, in my proofreading work (I'm a typesetter) to quickly spot some kinds of commands like vertical space modifiers or page ...
0
votes
0answers
56 views

Macros to show page number on the right side of the footer

I want to show page number on the right side of the footer. Currently, it's shown in the center of the footer. This is my macros: % Macros to format the page numbering. \def\ps@myheadings{\let\@...
0
votes
0answers
49 views

\isdefempty not working for multiple macros

I am still learning tex. The following example allows me to check if a variable exists, and if it does then prints some text in the PDF. This works great. However, when I add in a href, this appears ...
0
votes
0answers
67 views

Add a picture from a macro file

I would like a have a macro that draws a boat. In a .sty file I declared: \def\bateau{\scalerel*{\includegraphics{/Users/colas/Documents/Maths_2017_2018/Macros/boat.pdf}}{b}} and put the boat.pdf ...
0
votes
0answers
84 views

How to change case of first letter in a reference

How to completely control the case of the first letter of a referred title does exactly that but it seems to me that one command should do it *emphasized text*\documentclass[11pt]{book} \usepackage{...
0
votes
0answers
41 views

Loading a package when a macro is used

So, I have a big preamble that I use for all my homeworks. For some homeworks, I have to typeset code, for which I typically use the minted package. I have a little macro \pyminted[1] that stores the ...
0
votes
0answers
20 views

How to use \perform of lhs2tex in a \newcommand

I was trying to define a command \runx, which not only evaluates a Haskell expression (this is what \perform already does), but also prints the expression before the evaluation. So I tried \...
0
votes
0answers
54 views

How to make a command that colors the next 'n' rows of a table with some given background color, and then invokes some other command

I'd like to know if it's possible to make a LaTex command that does the following: The parameters to this command are 1) some integer (we'll call it n, for reference), 2) a color name, 3) the name of ...
0
votes
0answers
468 views

How to do \ifnot in latex?

On the question Is it possible to keep my translation together with original text? one of its answers use a if then else: \documentclass{article} \newif\ifenglish \englishtrue % Will show English ...
0
votes
0answers
118 views

Shortcuts made on new command skip 'eat up' the space and the next few letters after itself

In my report, the phrase "separated representation" is used very frequently. So, I created a macro \newcommand{\seprep}[1]{separated representation} However, when I use the command, it eats up the ...
0
votes
0answers
63 views

Macro within longtable handling

I got two questions regarding the handling of longtable items: 1. I predefined some macros for a better handling of my longtables. In my style file I got this for a non-final row end: \newcommand{\...
0
votes
0answers
333 views

Memoir class command @textsubscript already defined

I am trying to compile a very simple document with the memoir class but I am getting a Command \@textsubscipt already defined for anything I try to do with this class. Something is clearly out of date ...
0
votes
0answers
234 views

Context free LaTex

Apparently, Parsing TeX is Turing-complete. I however, do not write TeX but LaTeX. In that process, I profit from assistance by editor plugins like Auctex et.al. These plugins rely on a syntactic ...
0
votes
0answers
34 views

create custom badness for pagebreaking over a custom area

This is a - as I think - tricky question. I want to create and/or modify a badness for pagebreaking/newpage. It should work like this (pseudo code): \begin{areaOfBadnessValid}{badnessvalue} \...
0
votes
0answers
158 views

Command calls with multiple parameters

I'd like to improve the latex code from a previous answer by using it all along a resumé which I've reproduced below. The MyFrame command have to be called around 20 times but using different items ...
0
votes
0answers
52 views

Sorting macros by their first argument

Let's say I have a document consisting mainly of ''task''-macros that are defined as following: % bold titles \newcommand{\mypar}[1]{{\bf #1:}} %task decription template \newcommand{\task}[3]{ \...
0
votes
0answers
369 views

Translations from other languages for English with Latex

The problem with doing translations in LaTeX is this: I use the Wordfast program to "record' everything that I tranlsate (Worfast is not a machine translation tool; it is a macro that runs inside Word ...
0
votes
0answers
45 views

How to create command that associates pieces of content to keep them on same page?

I've pieced together a class for my preferred format of Cornell notes, and it allows for floating a summary to the bottom of a page. But, it requires manually choosing the page that will host the ...
0
votes
0answers
50 views

How can I recognize a dot followed by a space and output dot?

In the following code I cannot figure out what to use for \SPACE and \DOT such that \peektoken is compared to a space( ) and a dot(.) is produced as output along with the result of the test T(rue) or ...
0
votes
0answers
63 views

beamerarticle and minor problems with caption

I have a major and some minor problems with the MWE below. The major one: when I uncomment \usepackage{beamerarticle}, my macro definition starts to contain some extra '}', probably some macro ...
0
votes
0answers
421 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 ...
0
votes
0answers
196 views

Macro passing problem with pgfmath

As a continuation of thread https://tex.stackexchange.com/questions/233658/2010-2014-versions-difference: I am trying to decorate program listings with highlighted lines, numbered balls, etc. In 2010,...
0
votes
0answers
156 views

Ignoring parts of text inside macro

Consider the following code: \documentclass{book} \usepackage{pgffor} \begin{document} \newcommand\containers{ \cont{aaa{\bf don't xstring me}aaa} \cont{bbb\large bbb} \...
0
votes
0answers
123 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 ...