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 [environment-variables]

Environment variables like TEXINPUTS, TEXCONFIG, BSTINPUTS direct the working of tex and related commands, mostly by specifying where to look for packages, styles, etc.

0
votes
0answers
24 views

Conditionals: “Incomplete \iffalse” [duplicate]

I'm using a boolean variable called flag to toggle extra text being shown or not in tables. I am following this post: Variables for hiding or showing text in Latex \documentclass[12pt, twocolumn]{...
1
vote
1answer
19 views

Embedding if statements in environments

I am trying to write an environment so that I can toggle on and off the answers to questions on a hand out. I also want the answers to appear red and then the main text go back to black after the ...
3
votes
1answer
100 views

Code between \begin{environment} and \end{environment} stored in an array

Is there a way to store the text between the \begin and \end commands of a generic environment in an array? A code that obviously doesn't work but shows what I mean is the following \documentclass{...
0
votes
0answers
25 views

Is it possible to make an “if” section in TeX which is conditional on an environment version being set?

I'd like to produce two slightly different versions of a document. One will include confidential information, the other will be slightly redacted. Is it possible to use an environment variable and ...
2
votes
1answer
149 views

shell-escape and “tput: No value for $TERM and no -T specified”

I am using TexStudio 2.12.6 on TexLive 2015 (Debian). If I add the option --shell-escape to my compile command lualatex --shell-escape -synctex=1 -interaction=nonstopmode -halt-on-error %.tex, I ...
0
votes
2answers
55 views

Directly get the value of a defined command

I defined a new comman or a definition which should store the value of my default font with: \newcommand{\defaultfont}{\fontname\font} However, when using this command inside a tabular environment ...
2
votes
1answer
62 views

Passing parameters to a class variable

I'm trying to create my own colour theme for my document class. At the moment my solution is to use a class parameter: \DeclareOption{colour-theme-formal}{ \definecolor{soft}{gray}{0.75} \...
0
votes
1answer
45 views

Text variable ignores nested formatting

I'm trying to make a title page within a class for future use within my university. I want users to be able to set the title in the main.tex, and then the custom.cls will make it larger and uppercase, ...
1
vote
2answers
190 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 ...
1
vote
1answer
208 views

pdflatex cannot find file but kpsewhich does

I have a header.tex file sitting in $TEXMFHOME/tex/latex/ and I tried using \input in another .tex file in some other directory. Note that kpsewhich is able to find header.tex, printing its full path, ...
2
votes
2answers
83 views

How to combine/unite/merge two environments?

I have two enviroments (equation and tabular), which should be located near to each other. %!TEX TS-program = xelatex \documentclass[14pt, a4paper]{article} \usepackage[T2A]{fontenc} \usepackage[utf8]...
3
votes
3answers
450 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 ...
0
votes
1answer
390 views

Define the graphics path in the header for TeXstudio

TeXstudio opens a preview, when the mouse cursor hovers the \includegraphics command. Unfortunately this does not work, if a graphicspath is set for the document. It seems that TeXstudio 2.12.4 does ...
4
votes
1answer
474 views

How to set environment variables for TeX in Latexmk?

By setting max_print_line=1000 in texmf.cnf or the environment, the logfile becomes more readable. How should we set the environment in .latexmk? I want to set the variable per project. Not global.
1
vote
1answer
299 views

Compare two macros as strings in LaTeX (e-TeX)

How do I compare two macros that are one-expansion away from being strings? \def\A{ICT} \newgetenv[\ICT]{\A} % `\newgetenv` from https://tex.stackexchange.com/a/184924 Now I want to check if ...
1
vote
1answer
272 views

Environment variable \def if defined else \def default [closed]

Bash example # echo ${FOO:-bar} bar # FOO=haz; echo ${FOO:-bar} haz LaTeX attempt: Repo: https://github.com/AlecTaylor/latex-env-testcase Command (defined in preamble) % Edited from: https://tex....
0
votes
0answers
161 views

Variables for LaTeX in Lyx?

I created a table in LaTeX in the Premables. Original code below, Premables without the code, and a PDF output of it - I put placeholders (just text) for different kinds of text that I want to put in ...
2
votes
0answers
85 views

Problem with many tikz picture for every rendering

I have many tikz picture in my text, and for every rendering of LATEX, I waste hours to external pdf is produced. If there is a way to define samples=100 as a variable, (like var1:=100 in programming) ...
3
votes
2answers
118 views

How to give a name to a subdocument

I am generating reports, like this... \clearpage \section{Gold and SPY} \noindent \begin{minipage}{0.60\textwidth} \centering \includegraphics[width=1.0\textwidth]{graphs/goldport.pdf} \end{...
1
vote
2answers
280 views

How to escape a list of underscored filenames efficiently?

I am thinking how to read a CSV file which has filenames which have underscores efficiently into a LaTeX variable. I think reading the raw variables into a variable by input and then manipulating ...
2
votes
1answer
126 views

Is there some ${HOME}/.texrc or ${HOME}/.latexrc config file that will be read by latex, bibtex, etc

I find myself copying the same export TEXINPUTS=fubar:$TEXINPUTS lines for different applications that don't all read the same environment configurations files, e.g. xterm vs. Emacs's compilation-mode....
1
vote
0answers
415 views

TEXINPUTS equivalent for inputminted to make relative paths work?

A while ago I griped about LaTeX not supporting relative paths by default. It turns out I can export the TEXINPUTS=/path/to/source environment variable to make \input{foo} look in /path/to/source/foo. ...
1
vote
2answers
285 views

Accessing a possibly undefined system environment variable from LaTeX (followup question)

This question is a followup to this thread in which @egreg provided a command \getenv to access a system environment variable. In response to my comment, he suggested a way to expand his script so ...
1
vote
1answer
168 views

Using a system environmental variable in href for a pdf document

Is there a way to use a windows environmental variable in \href that uses this environment variable in the output PDF document? When I use \href{run:\%foo\%\\bar.cpp}{bar.cpp} The PDF Reader I use ...
1
vote
1answer
65 views

TexLive on Mac - commands return no results or errors

You'll have to excuse me being new to TeX, but on my Mac, typing any TeX command (after installing TeXLive 2016 from the DVD) produces no result and doesn't even show an error, which makes me think ...
0
votes
0answers
37 views

Have document's \parskip in minipage [duplicate]

I embed an illustration of variables next to the paragraph describing them: \noindent\begin{minipage}{.48\textwidth} \indent Lorem ipsum \end{minipage} \hfill \begin{tikzpicture} … \end{...
2
votes
1answer
67 views

If and how can I add a variable and use it in commands?

How do I define a variable that can be used in commands? If it is even possible? I want to assign a length to a variable and use it in \addvspace, like: \newcommand{\xxx}{1em} \addvspace{\xxx} Or: ...
4
votes
0answers
131 views

Does this kind of thing exist in the LaTeX habitat? Or is metaprogramming in order? [closed]

You know how matrices have coordinates like this: Is there any way that I can import a .csv and then have automatically produced variables like \a11 and \a12, etc. Of course, unless there is an ...
3
votes
1answer
91 views

Anonymous listings environment

I would like to be able to switch off the listings counter individually with asterisk (*), like one would suppress an equation number using \begin{equation*}...\end{equation*} As with the equation ...
19
votes
2answers
4k views

How to read a Variable from a file in LATEX?

How to read a variable from a file, lets say textfile var.txt that contains the following: foo = 10 bar = 20 Now I am looking for a command \missingcommand that scans the file and it can be used in ...
2
votes
3answers
295 views

Filling in colors in frame macros

I am hoping the answer to this question is a simple, so apologies for my ignorance. Based on posts here, I was finally able to make the frame appear the exact way I wanted it to. I made the following ...
2
votes
1answer
86 views

Assign each drawing (line,path,etc.) as elements of a vector, so it can be recalled, used, and edited in looping

I want to know how to set drawing elements as variables(elements of a vector/array) so that it can be recalled and modified (in each loop). For example i have a line (\draw (start) -- (end)) and want ...
2
votes
1answer
60 views

Modifying command globally from within command

I've seen a couple of somewhat similar questions, but none with similar construct or -- I'll be honest -- none with answers I've been able to understand well enough to adapt to my situation. The ...
1
vote
1answer
313 views

How to install ttf fonts on xelatex + BSD for www user?

I have a web application that runs on apache tomcat. The user for the process is "www". The home directory of this user is "/nonexistent" and I do not want to change that. (It is set to a nonexistent ...
3
votes
2answers
132 views

How to implement a verbatim or null environment using a boolean within \newcommand

I am trying to use a boolean environment within a \newcommand statement to selectively implement a verbatim environment. When I set the boolean to true it should put the "Answer" within the verbatim ...
4
votes
2answers
77 views

How to have 2 arrays of variables in one document

I've used an example from Create an array of variables By adding a new \newcommand as in the code below: \documentclass{article} \usepackage{etoolbox} \newcounter{cnt} \newcommand\textlist{} \...
2
votes
1answer
220 views

Newcommand with PythonTex

I want to realize pytontex \pyc as newcommand so that I can use it in a generic way. When I use the newcommand I just get some strange "i" (I use it for enumerating the spec variable) and no output ...
2
votes
1answer
57 views

Switching between wrapfigure and figure environments

I'm trying to realise switching between wrapfigure and figure environments, using boolean control. But for some reason wrapfigure does not do what it should do - be wrapped, instead it is placed in ...
1
vote
1answer
562 views

Use variables/properties in class file

I have a class resume which I use in a .tex file as \documentclass{resume} \begin{document} \end{document} but I also want to define some variables in my .tex document to be used in my class. How ...
2
votes
1answer
358 views

Indexing issues with 2D arrays

I have a tikz code using values stored in a 1D array, here is a MWE : \documentclass{standalone} \usepackage{tikz} \def \myArray {{0,1,2,3}} \begin{document} \begin{tikzpicture} \...
0
votes
0answers
459 views

How to add more sty and cls locally?

Please be warned, despite this sounding very similar to Where do I place my own .sty or .cls files, to make them available to all my .tex files? it is a different problem. I need to generate PDF as ...
1
vote
0answers
185 views

How to strike out over an environment and formulas and using local variables in latex?

While I am revising my papers, for the sake of easier tracking and saving the time of the reviewers, and hence shortening the review process (I hope!), I use the following commands \usepackage{ulem} \...
4
votes
1answer
92 views

How to condense environments and options to one environment?

In order to make grey boxes around code in my document I am using: \usepackage{listings} \usepackage{xcolor} %custom colours \usepackage{mdframed} %nice frames \definecolor{light-gray}{gray}{0.95} %...
1
vote
0answers
81 views

Flexible space above and below an environment [closed]

I have used the amsthm package to define a new environment as follows: \newtheoremstyle{examplestyle} % name of the style {10pt} % space above {10pt} % space below {\normalfont} % font of body ...
6
votes
1answer
350 views

LaTeX — how to read current value of color?

I want to save the current text colour, then change it, then change back to the original. I was thinking of doing something like: \def\oldcolor{old colour here} % save colour \color{red} ...
2
votes
0answers
3k views

How to set PATH variable in portable miktex to be used with texmaker

When I perform ps->pdf or XeLaTeX I get error 'mgs.exe' is not recognized as an internal or external command, operable program or batch file. The solution for this is to add ...\miktexport\miktex\...
2
votes
1answer
202 views

How can I get a count of the optional arguments with xparse?

Question Is it possible to get and store a count of the optional arguments actually passed to an xparse declare argument/environment? Purpose Regardless of the number of arguments provided (...
3
votes
4answers
378 views

How can I typeset an environment and its literal equivalent in an environment?

This is a follow-up to the question: How can I typeset a command and its literal equivalent in an environment? It would obviously be useful to handle environments too. I imagine something like the ...
7
votes
1answer
2k views

Can I define a variable to scale with it several figures?

I have several pictures in my document, using the subfigure environment, the code is the following: \begin{subfigure}[b]{0.22\textwidth} \includegraphics[width=\textwidth]{pictures/...} \end{...
12
votes
3answers
803 views

How can I typeset a command and its literal equivalent in an environment?

UPDATE: I've opened a follow-up question: How can I typeset an environment and its literal equivalent in an environment? I would like to pass a command and arguments to an environment. The output ...