Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [variable]

The tag has no usage guidance.

0
votes
1answer
29 views

Define variables in document so that macro definition goes into preamble

I've written some macros to add OMR characters to the generated document. The OMR characters are needed for an envelope inserter machine. When I want to print OMR characters for a double-sided ...
0
votes
1answer
21 views

Change header from class file depending on whether or not a variable is declared in the document

I am trying to edit my class file to either have a header or not depending on whether or not a variable (\cv{}) is set in the document. I have scoured the internet for answers and based my initial ...
0
votes
0answers
20 views

Select one of many groups of array definition

I use variable.tex to definite some Array: Name, color, folder In main.tex: \input{variable.tex} In variable.tex: ( not exist begin/end{document} Each Group includes 3 Array: Name, color, folder %...
0
votes
0answers
20 views

LaTeX - Pass variable into a string [duplicate]

In LaTeX I am trying to pass a variable into a line for the \progressbar. If you type everything in it looks like this \progressbar[linecolor=blue, filledcolor=green]{.25} \begin{picture}(0,0)\put(-...
0
votes
0answers
30 views

Control PDF file folder & filename output by global variable

I use LaTeX with Texmaker. Is output PDF always in same folder with main.tex? I have Arrayvariable.tex: %Client Name \def\ClientNames{{"VarA"}} main.tex: \pgfmathsetmacro{\ClientNamesNull}{\...
0
votes
1answer
21 views

Looping for Two-column Signature Blocks

I'm trying to create a two-column area for signatures, so folks signing the document are listed in the left column or right column, and there are enough rows to accommodate everyone's signature. Under ...
1
vote
1answer
17 views

Variables (in some cases) not working inside `\href`

Given this small document class file mycustomloc.cls: \NeedsTeXFormat{LaTeX2e} \ProvidesClass{mycustomloc}[2019/03/06 My custom class] \LoadClass{article} \RequirePackage{hyperxmp} \RequirePackage[...
-1
votes
1answer
82 views

Use variables like #1 in math [closed]

I'm writing this small \newcommand, and I want to send numbers as parameters. But since the math mode always tries to interpret the # in a different way. I don't know what to do. Here is what I have ...
1
vote
1answer
30 views

How to use something like \label outside the table environment?

I would like to ask whether there is any way to use a \label-like command outside a longtable in order to reference this table in latex? It would be also helpful if the label of the table could be ...
1
vote
1answer
46 views

Generalising a second-order macro with loops

I'd like to construct a macro that can be used to define commands. Those commands behave like variables or structs of variables, such that they can contain multiple values. The "member" is passed via ...
2
votes
3answers
96 views

String variable with multiple values

I'm after a definition of a command that could have multiple values to use in different contexts. The use case for this would be in a custom class that uses two languages simultaneously, or I guess ...
0
votes
1answer
29 views

How to use defines in other files?

I can properly use a define \def <command> <parameter-text>{<replacement-text>} if it is define in the same LaTeX file, which is not the main file, but let's say, it is named 2....
1
vote
0answers
38 views

What is the TeX at symbol / @ for? [duplicate]

Edit Note: I am trying to research "switches" (like \chapter), which led to this question. It might be helpful to tag this "switches". I have seen a lot of documentation that appears to be using ...
0
votes
1answer
48 views

TikZ: how to memorize current coordinate into a variable during path creation

I am creating electrical circuits using CircuiTikZ. Quite often I need to connect to a certain point, which has been created previously using relative coordinates. Right now I have to calculate ...
2
votes
2answers
103 views

LaTex - perform algebraic operations on variables

Suppose I've got the following document: \documentclass{article} \newcommand\mass{30} \newcommand\acc{9.8} \newcommand\force{\the\numexpr \mass * \acc \relax} % F=m*a \begin{document} \section{...
1
vote
0answers
38 views

Define variable for color and \AbsolutePosition{x, y}

I have 10 files and each file has different distance variables and color variable in the code: \AbsolutePosition{\x_var}{\y_var}{ \begin{tikzpicture} \draw [\colour_var,fill=\colour_var] (0,0) ...
3
votes
1answer
114 views

How to pass boolean value to a tikz option key

I have trouble understanding how to properly use tikz keys and pass them. Let's say I want to code two tikz pics with both a "fill" argument. I sometimes end up writing things like the example below. ...
4
votes
3answers
71 views

Indexing variables

Is it possible to create variables that can be defined using integers. I would create an example to work with but I have no idea how to start. Hopefully the snippet I have included makes sense. % ...
1
vote
1answer
48 views

Input variable as argument in metapost script?

I would like to pass input parameters into my .mp script. For example, instead of running: mpost script.mp I want to run something like: mpost script.mp 1 1 2 diamand Where "1 1 2 diamond" are 4 ...
4
votes
1answer
92 views

Can you create concatenate variable names in LaTex? [duplicate]

I would like to create variables to hold strings like f(x)=3x+1 to be inputted into an exam questions. I can create variables like \funA, \funB, … et cetera. The problem is how do I reference them ...
3
votes
1answer
36 views

Variable expanding inside BibLaTeX \addbibresource

I am working with a custom class provided by my university for the typesetting of thesis. The class automatically includes BibTex references in the document. I want to modify the class to make it work ...
3
votes
1answer
89 views

Assigning a numerical variable with Tikz pgfmathtruncatemacro

I am struggling with some basic computations with Tikz and I have a problem assigning a value to a variable inside a local scope. Consider the following MVCE: \documentclass{article} \usepackage{...
0
votes
3answers
83 views

Logical markup for math symbols/variables, alternative to \newcommand

I would like to use markup for any math symbols/variables (Sorry, I'm not sure what is the correct terminology here). The reason is to make late changes of the naming convention easier by just ...
4
votes
3answers
76 views

xstring TeX capacity exceeded

I try to store the result of an xstring pagckage’s command in another command (or variable, I don’t care), to reuse it in another xstring’s command, as you can see in the following MWE: \...
2
votes
1answer
64 views

Printing all predefined variables and or values

So, whenever you begin a document by giving it some class (article, memoir, etc), there are many default lengths and heights being used. What I am looking for is a way to see these without explicitly ...
2
votes
1answer
24 views

Access a given colors from a preset array

I use a variation of the BlueBox chapter style in order to change the header color with each new chapter. For now i have to set the new color before each new chapter wich is not optimal. I wanted to ...
1
vote
1answer
48 views

Tables: how to parametrize ruler dimensions (e.g. thickness)?

I would like to define the parameters of my table rulers using some sort of variables, so that just by changing the variables definitions I can tweak the rulers without further need to change the ...
1
vote
0answers
53 views

Reduce spacing inside cell, vertical and horizontal positioning of figure & defining some text in preamble

I want to make a template document (with custom margins, font sizes, header, footer etc...). I have specified only footer on first page and header on all other pages, margins, text width, text height,...
1
vote
1answer
46 views

How to do arithmetic with variables used in for loop?

How can I use arithmetic inside a node's curly brackets? I have this, and it prints for example "0+1" in a circle. I would like to have circles that show the sum of their coordinates. \begin{...
1
vote
1answer
84 views

Suggested method of creating an end user editable variable with newcommand

I am trying to create a document template that would be used by many people where the end users can control certain values but most of the template style can be controlled centrally. Imagine a (...
1
vote
1answer
60 views

Save command result in other command

I am getting a value by a command. Now I am temporarily changing a saved variable which changes the command output. After I finished some code I want to reset the stored value if the value before the ...
6
votes
2answers
179 views

Variable argument macro to define splitting polynomial

I need a macro that behaves the following: \mpoly{x}{1}{2} outputs (x+1)(x+2) \mpoly{x}{1}{2}{3} outputs (x+1)(x+2)(x+3) \mpoly{x}{1}{2}{3}{5} outputs (x+1)(x+2)(x+3)(x+5) and so on. I am not at ...
5
votes
2answers
537 views

generate 100 pages document with consecutive numbers

I need to generate a 100 pages document with only 1 number per page starting from 1 till 100. Any idea?
4
votes
1answer
116 views

A question on pgfmath, variables, conditionals and scope

First, I would like to apologize for the vague title of my question, somehow I didn't manage to come up with something more precise. Based on an answer to this question, I wanted to create a function ...
1
vote
2answers
176 views

Passing a string into Sweave Rnw file

I understand from this question that it's possible to push a variable to an Rnw file from the R script that calls it by storing that variable in the global environment within the R script. I've tried ...
0
votes
1answer
87 views

Defining dynamic numeric variables and adding them

I'm designing an academic exam template, and would like to assign specific point values to individual questions, and then sum the point values on a given page to display at the bottom of that page. I ...
0
votes
0answers
33 views

Unknown Command for Variable [duplicate]

I have been unable to identify the command for this specific volume variable, V. The closest commands I identified were \vee and \wedge but they do not possess the curvature found in this format. Any ...
0
votes
1answer
63 views

Automation and variables

For school and exams, time is at a premium. Copying expressions and pasting them in a third party calculator is too time consuming. Not to mention if you discover that you have made a mistake, and ...
1
vote
0answers
67 views

Is it possible to create variables for each instantiation of an object? (as c++)

Let'say I have defined a new command that draws a tikzpicture. Every time I call this command, I 'instantiate' a new 'object'. Is it possible to create variables for each separate object that holds ...
0
votes
2answers
57 views

Typeset indexed function with parameters

I want to typeset something like \documentclass{article} \usepackage{amsmath} \begin{document} $$f_{A_{n,k}}(\omega)$$ \end{document} I don't know how to make the argument (\omega) to be typeset ...
3
votes
3answers
278 views

Variable Width Tilde

I wish to define a new macro, \vartilde say, so that \vartilde{a} produces the following: \tilde{a} while in inline maths mode, ie using $ ... $; \widetilde{a} while in display maths mode, eg using \[...
1
vote
1answer
89 views

Subcaption: Vertical image alignment - Pass through image height

I have two external graphics that I want to add to my document side-by-side using the subcaption-package at the same height. To get the height of the first file, I use \settoheight. In the subfigure ...
3
votes
3answers
428 views

Edit \today in such a way that it displays 1st/2nd/3rd/4th, etc. Month Year

I have found questions where \today has been edited – but in such a way which I do not want to have. Yet, I do not know how to programme it. If I write \today, I do not want to see something like ...
2
votes
1answer
203 views

use a variable in tikz pgfplot xtick

I was drawing a square function using pgfplots. So I defined the period \T, the number of periods \nbT, the max value \E. I can use those variables in my axis preamble except in xtick, how is it? My ...
1
vote
1answer
54 views

“Optional” package accept variable argument

\documentclass[12pt]{article} \usepackage[test]{optional} \begin{document} \def\optname{test} \optname \\ % Prints "test" \opt{\optname}{ TEST % does nothing }\\ \opt{test}{ TEST 2 % ...
0
votes
1answer
245 views

local temporary variable assignment

I am sure this has been asked many times already in many different ways, but can't get any of what I found so far to work. So here we go: I am using the following code (that I once found on here ...
2
votes
1answer
205 views

Using \pgfmathparse directly in another expression

I can store \pgfmathresult in a variable \y and then pass the variable to another expression (\pgfpoint): \begin{tikzpicture} \newcommand\displ{2} \pgfmathparse{\displ + 2}\edef\y{\...
2
votes
1answer
79 views

Chemistry diagram variable substitution

I would like to write a script for doing my biochemistry homework that utilizes variable substitution. For example, I could create a base molecule using ChemFig with an X on it, then substitute that X ...
4
votes
1answer
77 views

Using a conditional on a custom defined variable

Last month, I asked this question, about how to personalize a flowchart based on data available in a text file. The idea was to be able to adjust the width of arrows depending on numbers in the text ...
2
votes
1answer
73 views

Use of variable within the call of a function

I need to call various commands based on some combination of conditions. Due to a huge number of possible cases, it would be very convenient to use variables inside the name of the called command. Is ...