Questions tagged [parameters]
{parameters} is about the meaning, and the manipulation of fundamental parameters that guide the typesetting of LaTeX.
190
questions
0
votes
2
answers
65
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 --...
1
vote
2
answers
41
views
How to control expansion order to define variables from a prefix and a command?
The following is a command that does basic arithmetic with nine variables.
\documentclass{article}
\usepackage{xfp}
\newcommand\functesta[9]{
\edef\myvara{#1}
\edef\myvarb{#2}
\edef\...
4
votes
2
answers
223
views
How to get lipsum to accept a count as a parameter
I get the error: Missing number, treated as zero. trying to pass a counter to \lipsum. I feel like I might be forgetting some basic technique here, but I've unsuccessfully scoured the site to find out ...
3
votes
1
answer
56
views
Parameter text getter
To this snippet
\def\arg#1#2{\#1 = #1 and \#2 = #2\par}
\arg A B C
\end
I supposed the output like this one
#1 = A and #2 =
B C
But I get (using PDFTeX)
#1 = A and #2 = B
C
.
Why such behavior? I ...
0
votes
0
answers
49
views
How to create a multi-lingual document capable to render into multi languages?
I am thinking on some similar (intuitive tex code follows):
\en{That is the title}\de{Hier ist der Titel}
And then, if I somehow parametrize the rendering (for example, by giving some command line ...
0
votes
1
answer
102
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
\...
3
votes
1
answer
77
views
Minted: Using command for used language with inputminted
I have multiple different commands setup using \inputminted with different options but all are using the same language. Previously, i could feed all commands with a TeX primitive like so:
\def \...
2
votes
2
answers
94
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]{...
0
votes
1
answer
60
views
How do I parametrize this chapterimage command by an opacity argument?
I have the following chapterimage command, based on this book template (ILM Report by Jenny Lantair) which I use simply by this oneliner: \chapterimage{./res/headers/nature.jpg}.
\newcommand{\...
0
votes
0
answers
27
views
NewDocumentCommand inside NewDocumentEnvironment, and an illegal parameter issue [duplicate]
I am trying to write a macro like this:
\usePackage{xparse}
\NewDocumentEnvironment{myenv}{}
{
\NewDocumentCommand{\myarrow}{g}{\IfNoValueTF{#1}{\to}{\xrightarrow{#1}}}
\begin{enumerate}
}
...
2
votes
2
answers
135
views
How to get width of parameter in plain TeX?
I am trying to get the width of a macro parameter using
\def\getwidthof#1{%
\newdimen\myl%
\settowidth\myl{#1}%
\the\myl%
}
where \settowidth is defined as
\catcode`\@=11
\newbox\@...
0
votes
2
answers
86
views
Taking in optional boolean flags in a macro without expl3
I want to create a macro \verticalStep which will produce a vertical skip of fixed length, and take two optional arguments, negative and small.
So for you could use
\verticalStep for a standard ...
1
vote
1
answer
56
views
Want to add optional parameter to adjust tightness of \mybox
Following up on @Roman Starkov's \mybox definition for a tight \fbox (How to put a framed box around text + math environment), I'd like to add an optional parameter to adjust the pt allowance around ...
0
votes
0
answers
43
views
Differentiate package parameters for different versions of package
I have 2 versions of TeXLive:
2020 at home (as far as I remember)
2021 at work
I have a document with string:
\usepackage[group-separator = \;, decimalsymbol=comma]{siunitx}
It works at home, but ...
-1
votes
1
answer
243
views
How to draw neural networks from parameters?
This page by Izaak Neutelings offers some code to draw neural networks: https://tikz.net/neural_networks/ . Running the simple code from the top of said page yields:
\documentclass[border=3pt,tikz]{...
1
vote
0
answers
55
views
Use parameters of latexcommand in two .tex files
Im quite new to Latex and haven't found anything yet to help me with my problem. My problem is that i want to write the output of a command to another .tex file.
I want to use the custom command \...
0
votes
1
answer
77
views
Convenient way of having named optional arguments in macros
I am writing a macro with many arguments, many of which may be optional. Example of how I imagine it:
\newcommand{\mycommand}[width, height, density=1, joy=0]{Only \texttt{width} of value #width is ...
2
votes
2
answers
328
views
TikZpicture as newcommand with more than 10 parameters
I would like to build several Pareto diagram figures using a \newcommand, like this:
\documentclass[11pt]{amsart}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{xfp}
\...
1
vote
0
answers
27
views
Lettrine Parameter loversize Not Working with Drop-Cap Algorithm
Consider the following code containing a macro which produces a two-color lettrine:
\documentclass{book}
\usepackage{lipsum}
\usepackage{lettrine}
\usepackage{lmodern}
\usepackage{xcolor}
\usepackage[...
1
vote
1
answer
102
views
Specifying the Positioning Parameters for an egreg Two-Color Lettrine
This post refers to a two-color lettrine provided by egreg in Centering an Initfamily Letter within a Colorbox and Sizing It for Use as a Two-Color Lettrine.
Consider the code
\documentclass{book}
\...
0
votes
2
answers
82
views
How convert "string" into parameter? [closed]
How using \myfunction{"TEST"} to \mysuperfunction{T}{E}{S}{T}
I alvays have this same number of parameter
3
votes
4
answers
194
views
escape hashs (#) passed as argument to use them in inner macro
I am using nested macros using the xparse package, my ultimate goal being to have a custom macro factory. I have simplified my current problem here.
I want to give a pattern as an argument, like in ...
1
vote
0
answers
52
views
Parameterize call to macro [duplicate]
I like to parameterize the call to a macro. Please see the minimal example below. I think it is self-explaining.
Ultimately, I am searching for a way to call a macro by a string (kind of reflection).
\...
12
votes
2
answers
321
views
Variable number of arguments: generate alignment characters
I'm trying to define a command \letin that should produce something that looks as follows.
Note that it should support a variable number of "let" arguments and a single "in" ...
3
votes
1
answer
104
views
Space between horizontal lines in awesomebox
I need a small space between top & bottom of the paragraph
MWE
\documentclass[10pt,a4paper]{article}
\usepackage[margin=2cm]{geometry}
\usepackage{awesomebox}
\begin{document}
\setlength{\...
1
vote
1
answer
323
views
How to set an inline tcbox height to a fixed height (1em)
I'm searching for a way to avoid the following layout (image below) where the underscore and the lower case letters get tightened inside the tcbox : ideally, I'd like the tcbox to keep a height that ...
0
votes
0
answers
29
views
What is the correct way to type partial derivative in a parameter using \pd in commath package? [duplicate]
I'm using \pd{ }{ } in the commath package to type the partial derivative which saves lots of efforts than typing \frac{\partial }{\partial }. However when I want to have a pair of parameters around ...
0
votes
1
answer
189
views
Undefined control sequence error after MiKTex update on 2021-08-25 while using parametrized file
Last time I updated MiKTeX was over an year and till now the below MWE worked:
\begin{filecontents*}{tst.tex}
\begin{tikzpicture}[auto]
% placing the nodes
\node[signal] (input) {};
\...
4
votes
2
answers
217
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 ...
0
votes
1
answer
441
views
Using \RequirePackage with parameters
I want to outsource my preamble to a different file. So far I'm doing it with \RequirePackage. This ends up looking like this:
\RequirePackage{templates}
\begin{document}
...
\end{document}
My ...
1
vote
1
answer
154
views
Pgfplot nested loops with calculated parameter
I need to draw a finite number of cubes below a 3D surface. Thus I need nested loops. The following code is close to what I want, except that I want to modify the z limit for the \k parameter to have ...
1
vote
2
answers
143
views
Add optional parameter to def
So I was looking for a way to do something in latex, and I ran across the following MWE:
\documentclass{article}
\def\foo{1}
\def\bar#1 #2{%
\expandafter\def\expandafter\foo\expandafter{\foo {}#1}...
1
vote
1
answer
87
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:
\...
2
votes
1
answer
215
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
48
views
Getting the name of control sequence token - which values of \escapechar besides 32 require special attention?
I'd like to get the name of a control sequence token as sequence of character tokens.
With \relax I'd like to get relax.
The preceeding escape character is to be removed from the result of \string\...
1
vote
1
answer
3k
views
Error "paragraph ended before \text@command was complete" when I add \par in argument?
I have written a command to put a text in bold and give a line break. It works fine for me in single line text, but if I want to pass it an argument with pair it doesn't work for me.
How could I ...
2
votes
1
answer
422
views
Use \pgfplotsinvokeforeach with parameter
I'd like to use \pgfplotsinvokeforeach with a parameter to draw different plots with different colors.
What I tried is \pgfmathsetmacro but this does not work (see example, the value is fixed at 100).
...
0
votes
3
answers
1k
views
How to split the arguments of a command over multiple lines
I've defined a newcommand to create a reusable "requirement" component for my LaTeX document. The problem I have is that it seems like I need to have the entire command on a single line, ...
1
vote
1
answer
421
views
Use Case Template; Render enumerated list received from parameter
Desired Behavior
This Latex:
\documentclass{scrreprt}
\usepackage{usecases}
\setlength{\parindent}{0em}
\setlength{\parskip}{1em}
\begin{document}
\subsubsection{Example Use Case}
\begin{usecase}
...
1
vote
1
answer
238
views
Custom itemize with extra parameters for items
I am currently working on a document class for creating worksheets for school in which I want to include a multiplechoice environment. For this I basically used the itemize environment and changed the ...
1
vote
1
answer
73
views
Supplying small and large floating point values to moodlepackage
I am using the "moodle" package to create Moodle XML quizzes via Latex. Generally it works pretty well but I am having problems. If you are unfamiliar with the package, I can use environment ...
1
vote
0
answers
2k
views
How to change Pandoc's PDF conversion style?
In the past I could get Latex and Markdown files converted to PDF with Pandoc and I could get the output in different PDF styles. Now I forgot how I did it, and I can just get the default style.
The ...
1
vote
1
answer
36
views
How do I define a new function `\juse`
I want to define a new function \juse which takes 3 parameters and prints the second one.
However, this doesn't work:
\documentclass{article}
\newcommand\juse{#1#2#3}{#2}
\begin{document}
$\juse{ abc }...
2
votes
1
answer
43
views
How to build a newenvironment out of a parametric command?
I'm very new here even if I've used Stackexchange looking for answers a lot. For once I can't find the one I'm looking for so I have to ask it.
I'm a bit afraid it is a very simple question but I've ...
0
votes
1
answer
50
views
passing parameters
I have seen some examples that you can pass parameters to build a template such as \int_step_inline: you can write #1 to represent the current value of the loop. I wonder how it works and have some ...
0
votes
1
answer
55
views
How to define an empty parameter for minipage
minipage supports empty values for its optional arguments:
\begin{minipage}[c][][c]{1cm} test \end{minipage}
or
\begin{minipage}[c][\relax][c]{1cm} test \end{minipage}
but it doesn't if that empty ...
0
votes
1
answer
146
views
How to change `article` documentclass settings for some pages?
This is a follow up to this, and is also based off of this.
Current code:
\documentclass[12pt]{article}
\usepackage{float}
\usepackage[american,siunitx]{circuitikz}
\usepackage[margin=1in]{geometry}...
1
vote
1
answer
46
views
pgfkeys: Read one key and ignore the others
In my own command \includegraphicsextended I want to add a caption to the pdf page containing
File [filename] Page [pagenumber]
therefore from the keys in %1 I want to just read the page=... key ...
2
votes
1
answer
540
views
How to change a \tikzstyle parameter according to a variable
I'm trying to define a document where I have different levels of it contained in TikZ boxes as shown below; the idea is that each box should get a color depending on the value of the counter (which is ...
2
votes
1
answer
124
views
How to input a tex file in a newcommand statement?
I read about my task here. But I didn't get working it for my needs. MWE:
\begin{filecontents*}{compensation.tex}
\begin{tikzpicture}[auto]
%placing the nodes
\node[signal] (input) {};
...