Skip to main content

Questions tagged [variable]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 views

Can a variable be passed to the same program to iterate over, instead of editing the source and running it with distinct values?

My MWE is: \PassOptionsToPackage{rgb,dvipsnames,svgnames,dvipsnames,hyperref}{xcolor} \documentclass[border={2pt},tikz]{standalone} \usetikzlibrary{math, calc} \begin{document} \begin{tikzpicture}[...
chandra's user avatar
  • 3,104
1 vote
2 answers
40 views

Counter value not displayed in \foreach loop

I try to write a command that displays a table with the number of lines passed as parameter. It's working fine except that in this MWE, the value of the \i variable is not displayed. I have no idea ...
Sylcha's user avatar
  • 43
0 votes
1 answer
68 views

how to put uppercase text into a variable [closed]

with this code \documentclass{article} \usepackage{graphicx} % Required for inserting images \begin{document} \newcommand{\TeIII}{ tit e3 } \newcommand{\AeIII}{\UseName{author24} } \...
RenatoP's user avatar
  • 851
1 vote
0 answers
22 views

How to store individual entries of a CSV file in variables with csvsimple

I would like to save different entries from a csvfile as variables in Latex. Here is my code \begin{filecontents*}{DateTime.csv} Group;Date;Time Group 1;27.05.2024;13:00 Group 2;28.05.2024;18:00 Group ...
Roman's user avatar
  • 21
2 votes
1 answer
73 views

how to create variable and use it or something else

on my project (always the same) I have some author names that are always the same (pippo pluto paperino...) I would use the correct name In a specific place, without edit it, but just inserting the ...
RenatoP's user avatar
  • 851
0 votes
2 answers
64 views

can I select part of content variable and assign to another varIABLE?

\documentclass{article} \usepackage{graphicx} % Required for inserting images \newcommand{\TaI}{111222333444555. 666777888. 9990000. } \newcommand{TbI}{} \begin{document} \TaI \end{document} I ...
RenatoP's user avatar
  • 851
1 vote
1 answer
27 views

Define tick labels in PGFPlots with a variable

When I try to specify ticks / tick labels in PGFPlots using a variable (for automatic report generation for example), it works for the ticks, but not for the tick labels. Here is the code I use: \def\...
Philippe's user avatar
0 votes
1 answer
17 views

vscode to rename pdf files after compilation according to patterns

In Linux, I created a Makefile to rename my output pdf files according to the patterns required by my projects. Those patterns are filled from variables fetched from the tex source files themselves. ...
22decembre's user avatar
1 vote
1 answer
95 views

How do I store plain text inside a variable (i.e without any formatting)

I'm trying to store text in a variable like \def\course{Statistics} but I want the text to be relaxed everywhere I execute the command. When I input \def\course{\relax Statistics}, the text is relaxed ...
Caleb Aryee's user avatar
0 votes
1 answer
33 views

Add a variable to longtblr, representing a vertical distance

This is a follow-up question to Add a long text in a longtblr spanning the entire width of the table. Given the following table (a longtblr): \documentclass{article} \usepackage[a4paper,margin=1mm]{...
Ommo's user avatar
  • 849
1 vote
0 answers
46 views

Need help to make single character with multiple accents

I need to fix the character with two accent's for (Caps,SmallCaps, Italic, Bold and various fontsize character's). But output clashing with accent characters with respect to character height. (Could ...
murugan anbu's user avatar
1 vote
1 answer
58 views

Displaying variable which is defined after the variable is used in text

I have a situation where I need to access a variable which is defined after it is used in the text. An example of what I'm trying to achieve is below, essentially the definition of variable happens ...
John Tracey's user avatar
0 votes
0 answers
48 views

How to compose "variables" in the animate package within the multiframe command?

I am using the \multiframe command to create a loop \multiframe{54}{i=1+2 }, starts the loop at i = 1 , increases i by increment of 2, and 54 times Within the loop, you can use \i to refer to the ...
stackoverflower's user avatar
0 votes
1 answer
113 views

Validity of \def in tikz

The following code does not resolve the defines inside tikzpicture and thus does not print the labels. \documentclass[tikz]{article} \usepackage{keycommand} \usepackage{ifthen} \usepackage{tikz} \...
RootRaven's user avatar
  • 249
3 votes
2 answers
113 views

LaTeX macro for summing numbers

I have a very simple LaTeX problem which confuses me. I want to write a macro which creates a running total of given numbers. The answer by Ulrike Fischer here is almost exactly what I want - simple ...
SvenForkbeard's user avatar
0 votes
0 answers
55 views

Automatically calculate years of experience from provided start/end dates

I'm very very new to LaTeX and not even sure if this is possible. \resumeSubheading {Undergraduate Research Assistant} {6 Years \& 3 Months} % 1 <---------------...
Aagam Sheth's user avatar
7 votes
1 answer
120 views

Passing integer expl3 variables to a Lua function (via \lua_new:e)?

Given the following MWE: \documentclass{minimal} \ExplSyntaxOn \int_new:N\g_test_myint_int \int_set:Nn\g_test_myint_int{2} \cs_set:Npn\__test_dostuff: { \lua_now:e{tex.sprint(1)} % Works just ...
Chris W's user avatar
  • 73
2 votes
2 answers
864 views

Displaying values of latex variables

What would be the procedure to see the value of a latex variable such as \baselinestretch and \parskip. Macros, such as \baselinestretch): \show\baselinestretch and for a dimension such as \parskip): \...
Veak's user avatar
  • 1
0 votes
2 answers
129 views

Check if parameter in command is declared/empty in LuaLaTeX

I'm trying to check if a parameter is declared/empty using lua. So far I wrote the following MWE: \documentclass{standalone} \def\var#1{\def\@var{#1}} %\var{Hello world} \begin{document} \@var --...
Levy's user avatar
  • 1,177
3 votes
1 answer
128 views

Define variable in LaTeX with value contain mathematical operator

\documentclass[a4paper,oneside,12pt]{book} \begin{document} \def\s{(1/(2+sqrt(2)))} \s \end{document} I want make a variable \s with the value 1/(2+sqrt(2)). LaTeX cannot automatically ...
Ongky Denny Wijaya's user avatar
0 votes
1 answer
22 views

Variables set within tables and reused later in the document

I am writing a document that involves a table of information for many sections, something like: \textbf{Details:} \begin{table}[H] \begin{center} \begin{tabularx}{\linewidth}{|X|c|c|c|c|c|} ...
BugInACode's user avatar
2 votes
1 answer
80 views

How to properly set optional boolean parameter for pic in tikz?

I try to draw beam on tikz with the possibility to hide its axis. I created the following: \documentclass{article} \usepackage{tikz} \usetikzlibrary{math, shadings} \usepackage{ifthen} \tikzset{ ...
Sindzicat's user avatar
  • 143
1 vote
2 answers
55 views

How to use a variable in a thmnote

I'd like to have the "theorem name" of a theorem be populated using a variable. It isn't working as I had hoped, see below. I'm especially confused because I can successfully get the "...
macbeth's user avatar
  • 123
6 votes
1 answer
270 views

Variable naming inside l3keys

I have a question about naming variables. In expl3, the variable naming convention is the following: \<scope>_<module>_<description>_<type>. The <scope> can be l, g, or c,...
User23456234's user avatar
  • 1,886
2 votes
1 answer
68 views

Operation with counter values of two \foreach loops to reference element of array in tikz

I would like to use the \x and \y variables of the two nested \foreach loops in my tikz script to reference the elements of a list. The code looks like this : \documentclass{minimal} \usepackage{tikz} ...
lazerbeam's user avatar
2 votes
2 answers
196 views

How to use loop for creating defined number of newcommands counting authors

For my template I want to create possibility to define a number of authors and automatically create a respective number of variables/commands which save the name of any author and make it able to ...
lukeflo's user avatar
  • 1,597
2 votes
2 answers
64 views

Illegal unit, and missing number when trying to define variables

When trying to make a sequence of graphs of step functions, I wrote the following code snippet: \begin{tikzpicture} \pgfmathsetmacro{\n}{2^3}; \pgfmathsetmacro{\step}{1/\n}; \foreach \i in {0,\step,......
Addem's user avatar
  • 879
1 vote
1 answer
56 views

Comparing pgfkey variable against a string

I want to check a mutable variable against many possible values, so that a macro will behave differently based on that value. Since there are many variables, they are stored using pgfkeys. Testing ...
eduardofischermath's user avatar
0 votes
1 answer
34 views

How to place a defined variable at multiple locations

I would like to use the defined variable - \arrows[#1] - from this tikz example: https://texample.net/tikz/examples/overlapping-arrows/ % Overlapping arrows % Author: Elena Botoeva \documentclass{...
David Cross's user avatar
0 votes
1 answer
368 views

Pandoc CMD call tex template and pass variables

I'm trying to pass variables to a tex template to generate a PDF with those values via pandoc. This is my template: \documentclass[15pt]{article} \usepackage{sectsty} % Margins \topmargin=-0.45in \...
Lucas Fath's user avatar
1 vote
1 answer
55 views

Improve custom-defined variables

I am using the following code to define new custom variables, along with the existing ones, and use their values later in the document. \newcommand\subtitle[1]{\newcommand\zzsubtitle{#1}} \newcommand\...
Subhajit Paul's user avatar
0 votes
1 answer
34 views

How to avoid spacing issue when inserting def value in text?

When I define a variable: \def\company{ACME} And use it: The company \company is... I usually have the trailing space eaten by the command resulting in The company ACMEIs So I do the following: The ...
nowox's user avatar
  • 1,417
1 vote
2 answers
43 views

How to properly shorten if condition?

\documentclass{article} \title{} \author{} \date{} \begin{document} \newcommand{\mybold}[2]{\ifnum #1=1 \textbf{#2} \else{#2} \fi} \mybold{1}{This should be bold} \mybold{0}{This should NOT be bold} ...
nch7822's user avatar
  • 11
2 votes
1 answer
116 views

reusable section templates and variables

I'm looking for a way to declare a section (a chapter for instance) like that: \startchapter[title={My first interview}][author={Jane Doe}, year={2022}] … \input knuth \stopchapter \startchapter[...
Alex's user avatar
  • 55
0 votes
0 answers
116 views

Create new variable that can change along the document

Apologies for the vague title, I do not know how to word this question properly. I want to create a variable that keeps track of the date on which I finished a certain section of my course notes while ...
Lorenzo Riva's user avatar
0 votes
0 answers
71 views

Is there any way to simplify a variable expression or solve for a variable in terms of variable in Latex?

It would mean so much if someone could help me with this. I am doing some research and am using models and for my math analysis, I have to solve for C using this simplified version of my model. Is ...
Elaine Garrett's user avatar
3 votes
1 answer
333 views

LaTeX array variable

Can't seem to figure out how to create a variable containing multiple numbers. \def\numbers{{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15},{16,17,18,19,20},{21,22,23,24,25}} \numbers[1][1] Expected ...
Swepz's user avatar
  • 33
0 votes
2 answers
156 views

Looking for an alternative to \numexpr: an intuitive interface for LaTeX numeric expressions

The xparse package makes writing commands easier and more flexible. The ifthen package does the same to conditionals. Is there a similar package for numeric expressions? Even better if it interacts ...
Evan Aad's user avatar
  • 11.1k
3 votes
2 answers
235 views

What is the difference between {} and [] parameters? [duplicate]

Most commands use {} to receive parameters. For example $\binom{6}{2}$ typesets the binomial coefficient 6 choose 2. However \sqrt receives a [] parameter as its first parameter. For example $\sqrt[3]{...
aker9397's user avatar
0 votes
1 answer
299 views

Babel: command for displaying current language

I would like to know if there is some variable in LaTeX that stores the currently used language. The context is that I have some command, lets call it \printText which prints text in the current ...
Vebjorn's user avatar
  • 1,884
1 vote
1 answer
147 views

How to remove a variable? [duplicate]

Is there a way to delete a variable so that any future references would raise an undefined control sequence error? I am dealing with a big document that has a lot of custom variables and macros with ...
gler5522's user avatar
0 votes
0 answers
56 views

Cannot save value to variable

This code defines a custom printing function that prints the numbers 1 to input. \documentclass{article} \usepackage{tikz} \begin{document} \newcommand\mynewprint[1] { \foreach[parse=true] \i in {...
landing3252's user avatar
0 votes
1 answer
252 views

Read metadata from a file

Say all homework files: hw1.tex, hw2.tex, ... use some common homework.cls. Problem is that in every hw*.tex file these variables have to be set manually. \documentclass{homework} \author{John Smith} \...
AvidSeeker's user avatar
2 votes
1 answer
35 views

Using the result that is generated later on the first page

The exam class allows one to generate a gradetable that is dynamically generated depending on the number of questions, like so \documentclass[addpoints,12pt]{exam} \begin{document} \multirowgradetable{...
M. E.'s user avatar
  • 123
5 votes
2 answers
110 views

Redefine a definition with itself, without evaluate its content

I have this MWE : \documentclass{article} \usepackage[TS1,T1]{fontenc} \usepackage[french]{babel} \newcounter{nbrefpage} \newcommand\setindex[1] {% \stepcounter{nbrefpage}% ...
Pierre Dufays's user avatar
0 votes
2 answers
75 views

Evaluate just one part of a definition, and not the other part

Let's assume we have: \def\tmpnbrefpage{sometestpagetoken} how can we define a storedpageref variable, like (in pseudo-language): "storedpageref" = \pageref{\tmpnbrefpage} where ...
Pierre Dufays's user avatar
1 vote
1 answer
46 views

Redefine def by itself without evaluate

If I have \csname var:\foo\endcsname, how can I do that : \expandafter\gdef\csname var:\foo\endcsname{\csname var:\foo\endcsname, \bar} ? I know I can do it with edef (or xdef for global), but in my ...
Pierre Dufays's user avatar
1 vote
1 answer
57 views

Fancy Header Custom Counter References

I'm trying to typeset a bible. In the header should be the current book name then the current chapter and current verse. By "current" I mean the next one in that page (or even the most ...
lmat - Reinstate Monica's user avatar
0 votes
1 answer
43 views

Printing according to conditional

I am using latex with babel and want to print the following, but within the context of a variable being set. What can I do? \begin{otherlanguage}{french} La Nuit Magique cédille Ç accent ...
Veak's user avatar
  • 1
2 votes
2 answers
165 views

Define categorized, changeable variables for use throughout a document

TL;DR How do I print categorized and subcategorized values declared in a JSON file (or in some similar type of file) inside of a LaTeX document? In my document, I am assigning a bunch of values to ...
Ben Zelnick's user avatar

1
2 3 4 5