Questions tagged [variable]
The variable tag has no usage guidance.
162
questions
0
votes
1
answer
98
views
How to use dynamic numerical variables in tikzpicture?
I am currently creating technical documentation that depicts through a tikzpicture the data flow across something called the I2C bus (example-like graphic). I initially started doing this by hand with ...
0
votes
0
answers
23
views
Conventions for Distinguishing a Property when Describing Different Objects
I have several objects, in this case they are indexed sequences which are used in an algorithm written in pseudo-code and in mathematical expressions. For example, there is $V$ and $S$, and there is a ...
0
votes
1
answer
62
views
cls Variable Fallback
Since I am not experienced with writing cls so it may be a very simple question and is a duplicate but I cannot use the exact word to express it.
Here is what I want to achieve in this cls:
There ...
2
votes
1
answer
63
views
Does the variable maker work only with latin letters and numbers?
How can I make the variable for non-Latex user, for example, using the \newcommand{}{} with parameters?
For example, I want the user change only the word in newcommand description and it will change ...
0
votes
0
answers
38
views
Placing a text macro's starting and ending values in the running head of a page
Background: I am editing the transcription of a historical manuscript using the memoir class. The transcription includes the folio numbers of the original manuscript, which are displayed in bold ...
2
votes
0
answers
42
views
Define variables local to tikzpicture
I'd like to understand how to properly use variables in TikZ.
I've read a large number of Q&A's and, so far, I've encountered \{g,x,e,}def, \newcommand, \pgfmathsetmacro, and \let.
The objective ...
2
votes
1
answer
62
views
Use a variable in foreach
I am trying to use a variable in my foreach loop. It would make things a lot easier, because i only need to change one value and multiple loops are affected.
Something like this:
\begin{tikzpicture}[y=...
0
votes
1
answer
39
views
Define options similar to \title, \author and \date
I'm creating my own class based on article and I would like to add a parameter subtitle which users of my class can set similar to title, author and date, e.g.,
\documentclass{myclass}
\title{My title}...
2
votes
1
answer
168
views
How to use Devanagari variable font in Latex
I have found a new variable font family for indic languages here https://github.com/EkType/Anek/. I want to use it for Devanagari text in LaTeX. Generally I use marathi package for using Devanagari ...
2
votes
1
answer
139
views
Run a forloop for a variable times
Consider this MWE:
\documentclass[varwidth=3in, multi={my}, crop, ignorerest=true]{standalone}
\usepackage{polyglossia, lipsum, forloop}
\usepackage[most, magazine]{tcolorbox}
\usetikzlibrary{patterns,...
0
votes
1
answer
34
views
When using \caption\expandafter\var{test} a new line is introduced?
I'm using \var{} in a caption but it introduces a new line?
\begin{table}[!ht]
\centering
\includegraphics[width=\textwidth, trim=1.2cm 6.7cm 1.2cm 0.8cm,clip]{P40_con_red_12.pdf}
...
3
votes
1
answer
37
views
Convert string of rational number to a variable and back [duplicate]
How can I convert LaTeX variables and strings when dealing with rational numbers? I have found many working examples for integers, but none for rational numbers.
\documentclass[12pt]{article}
\begin{...
1
vote
2
answers
92
views
How can I create a time chart with a non-uniform row height within TikZ loop?
The code below produces the given chart. (Thanks Sandy G! - see How do I create a timeline charts similar to this style? Suggestions )
I have made many modifications to this, even with additional ...
4
votes
2
answers
149
views
Assign a static value to a variable
I'm using the lgc package to generate random numbers.
\usepackage[first=-100, last=100]{lcg}
Assume I want to write the following equation
$$ a x^2 + b =0$$
where
$a,b$ % are random integers ranged ...
0
votes
3
answers
82
views
Using Latex code chunks as library - For reusing latex elements such as figures in multiple representations
In object programming languages often structs exist which help you to reuse code twice or often, but writing that code only one time.
A convenient way to write Latex code if the author does not want ...
0
votes
0
answers
37
views
Get value from other .tex without \input
I create a PDF document with pdflatex by attaching several .tex files with \input to each other through a loop. Now I would like to introduce a boolean in the single .tex files. Depending on whether ...
1
vote
1
answer
56
views
Store variables in a dictionary-like format
I am preparing a document that will have different versions with small differences. I want to create the document in such a way that I can use a dictionary which maps different versions to the ...
1
vote
1
answer
36
views
MetaPost vardef: how to declare a variable of type 'expr'?
I want to make a macro swap:
vardef swap(expr a, b) =
save tmp;
expr tmp;
tmp := a;
a := b;
b := tmp;
enddef;
But there is an error when compilating:
! A statement can't begin with `expr'.
I ...
1
vote
1
answer
54
views
Why does setting the /pgfplots/variable key interfere with the /tikz/variable key?
I need to set /pfgplots/variable because I have a lot of plots generated using gnuplot in my document. But, when I set /pfgplots/variable={t}, it breaks the plot macro in regular pgf. The MWE
\...
2
votes
2
answers
148
views
Pass a variable from makefile to latex code
I wrote a simple makefile to compile my latex code.
I have some variables in that makefile and I want to pass them to the latex code, but I don't know how to do that.
Example 1:
in makefile:
# set ...
5
votes
2
answers
121
views
Concatenate a variable with a string in a loop
I want to use subfile within a loop to add new pages to a document, depending on the number of lines in a .txt file. The .txt may look like this:
000100020003
The .tex Subfiles are A0001.tex, A0002....
0
votes
0
answers
59
views
Makefile - latex Compilation
I wrote a simple makefile to compile my latex documents using lualatex. I have two variables in this makefile that I want to pass to the latex code but I don't know how this can be done
Here is the ...
1
vote
1
answer
45
views
New command: Arithmetic-based image width
Theoretically, I think this command should create an environment which is slightly wider than the image it is meant to house:
\newcommand{\ListedFig}[3]{
\piccaption{\small #1} \parpic(#2cm,0pt){\...
3
votes
1
answer
60
views
Metapost: variable name with number at the end
Why can't I use variable names like a1, str2, x12? Does Metapost consider them as arrays so that a1 is like a[1] and so on? Even z-notation as z1, z2 and etc. does not work.
The code is
beginfig(1);
# ...
1
vote
0
answers
26
views
Box variable does not display its content
I'd like to use box variables and cannot deal with this example:
\newsavebox{\abox} % declared a variable of a box type
\sbox{\abox}{The block content} % abox := \hbox{The block content};
...
1
vote
1
answer
27
views
Variable/Command within Minipage declaration
I have a custom minipage environment that may have 2 different width values with the same basic setup. I create a \newcommand that stores which width to use when. These minipages go into a tabular* ...
1
vote
1
answer
68
views
How to use the same random number several times?
I'm using the xfp package to create a random number and defined the following command
\newcommand{\unif}{\fpeval{randint(1,10)}}
How can I assign a random number to a variable such that I can use ...
5
votes
5
answers
407
views
How to accumulate content into a variable and only then print?
This is what I'm trying to achieve:
\documentclass{article}
\begin{document}
\add{One}
\add{Two}
\add{Three}
\print % Only here "One Two Three" will be rendered
\end{document}
How can this ...
2
votes
2
answers
48
views
Confused with updating a newcommand constant inside a foreach loop
I am confused on how to update a "constant" construct inside a \foreach loop, the similar questions on here don't directly address the issue I am facing and I'm not experimented enough (yet! ...
3
votes
1
answer
159
views
using latex3 scratch variable
LaTeX3 provides tmpa and tmpb scratch variables for many different types. As documented, they may be overwritten by other non-kernel code and so should only be used for short-term storage.
What is ...
0
votes
1
answer
119
views
Formula in a variable that can be referenced later
Is there a way to put a formula in a variable (as in like a programming language variable) so that it can be referred to and rendered later? I was able to do this in Mathematica, but I'm moving away ...
4
votes
2
answers
87
views
newcommand in newcommand, value of variable as parameter
I have created a command which creates another command.
The parameter of the first command is a variable which is used in the second command.
I would like the second command returns the value of the ...
17
votes
3
answers
890
views
How to define von Neumann natural numbers (newcommand, with for loop)?
How can I define a new command, \natset[1]{#1}, which gives an output as follows?
(∅ = \varnothing); intended use is in math-mode, e.g. $\natset[1]{#1}$. The braces are the things one usually gets ...
4
votes
3
answers
104
views
Removing cumulative sum + defining local variables + if
The below code is wrong but it illustrates what I am trying to achieve.
How would you write the g command?
\usepackage{xfp}
\newcommand{\f}[1]{
\inteval{(#1 - \a) / (\b - \a)}
}
\newcommand{\g}[1]{...
4
votes
1
answer
113
views
An environment of tcolorbox to draw vertical lines configurable in numbers and in color?
I was inspired by the code of Ignasi in the following link:
Mark (highlight) a paragraph (\item{…}) with a squiggly line across several pages
I modified it to do the following command:
which draws #1 ...
1
vote
1
answer
32
views
Math system with external parameter
I'm writing a document where I need to define a system with an external parameter. Here an image to make it clearer:
I'm using this current code to generate a common system, here is an example:
\...
0
votes
1
answer
51
views
Centering math parameters description
I'm working on a document where I need to specify the meaning of different variables in some mathematical equations.
I'm dealing with this code I've found here in the forum (the post is 8 years old ...
0
votes
1
answer
73
views
Define a dynamic variable name and use it before its definition
I searched on the Internet but I did not find any solution for my problem, so I ask here.
Short Question
Is there a way to define a dynamic variable name in LaTex and use it before its definition?
...
2
votes
1
answer
148
views
What is wrong in this definition of a newcommand with variable number of parameters in its argument?
I want to define a command to draw schemas of the type shown in the following figure, but for an indeterminate number of branches. The inputs will always be positive integers.
The numbers of the ...
1
vote
0
answers
27
views
Making a new enviroment that uses tables which get added automatically to a list of tables by simply using the enviroment
I'm trying to make a list of definitions. I've defined the enviroment "defi" through a tabular enviroment. I want the definitions to be added automatically to the list with it's ...
0
votes
0
answers
28
views
Display document styling variables
My tex-illiterate teacher wants to check the formatting of our submission (e.g: margins, fonts size, spacing, etc...)
Unlike WYSIWYG, it is not possible to select text and know its properies.
Question:...
0
votes
0
answers
52
views
How to create a TeX variable whose name depends on a parameter
I would like to create multiple \newwrite in my document, for instance: one by chapter.
I've tried the following but it doesn't work.
I guess, in the end, my question falls back to: giver a parameter #...
1
vote
1
answer
59
views
How to enforce a second run for defining missing references?
Extending the solution to my previous question I would like to tell LaTeX to run multiple times until the variable is defined. In the demo example, I want section A and C to be identical in output. ...
2
votes
1
answer
64
views
How to remove the last or some item from a sequence?
How I can remove the last item from a sequence? I read the expl3 documentation, what I have is \seq_gpop_left/right, but I don't want to copy the deleted item in some tlist. Also I want to know, for ...
1
vote
1
answer
101
views
How to save text in variable and print it afterwards?
I would like to create a command that: when an argument is given, it saves it "somewhere", and when no argument is given, it prints all saved arguments. Something like this:
\example{text1}
\...
0
votes
3
answers
461
views
How to draw a circle with radius from variable?
I want to draw this simple picture:
The shapes of points (blue circles) are not important, they are just for example.
The point is that I want to have smth like variable R inside {tikzpicture} ...
2
votes
2
answers
59
views
Is it possible to output a relative line number in flagderiv?
I am trying to output a number relative to the current step of my proof instead of being hard coded. I'll try and explain what I mean with this proof:
\documentclass[11pt]{article}
\usepackage[...
0
votes
2
answers
80
views
Can tikz plot a recurrence relation using `foreach` and no global definitions?
I would like to know you to plot a recurrence relation using foreach, which requires updating a variable inside the loop. To make this concrete without copying over a bunch of code, please consider ...
0
votes
1
answer
168
views
Using Tikz package to extracting length, coordinates and assigning them to variables
The code below is extracted from:
"\internalforces" command in stanli package
(code exam1b - The second coding set in this example)
and
Using reference points in "Stanli"
Is there ...
0
votes
1
answer
77
views
Leave space for three logos on the title page [closed]
I am working on realizing a thesis template according to the requirements of my University. I would like to have the space for three logos in the title page, a big logo in the middle and two smaller ...