# Tag Info

9

May be you needn't to deal with the name of the file or with another special identifier at the start ot such file. If I understand your question, you need only simply type \pragmaonce at the start of the file. I've looked to the LaTeX internals and I've found that: if the \input is followed by {, i. e. \input{filename}, then the \@iinput{filename} macro is ...

5

Something like this at the start of your interactive file: \typein[\choice]{What kind of document are you creating?^^J type a for article^^J type b for book^^J } \if a\choice \documentclass{article} \else \if b\choice \documentclass{book} \fi \fi This is a little easier to code if you give the user only numerical options: \typein[\choice]{What ...

5

Thanks to the pointer given in the comment by Please don't touch, at Iterate through folder foreach picture, possible?, the following modifications to that MWE allow the picture range to be specified as arguments 3 and 4 to \IterateImages. The logic that allows the ranging of the inserts is given by the code: ...

5

If you load mydefs with \usepackage, giving it the .sty extension, LaTeX will load it only once. But it will not be available after \begin{document}. The analog of #pragma once could be \ifcsname mydefs.tex\endcsname \expandafter\endinput \fi \expandafter\gdef\csname mydefs.tex\endcsname{loaded} <code in mydefs.tex>

4

If I understand well what you're asking, you can do that with the etoolbox package: \documentclass[a4paper, 11pf]{article} \usepackage[utf8]{inputenc} \usepackage{lmodern} \usepackage[table, x11names]{xcolor} \usepackage{booktabs, caption} \colorlet{shadecolor}{LightSteelBlue1} \let\mytoprule\toprule \renewcommand{\toprule}{\mytoprule[2pt]} ...

4

The mystery is readily solved: tabu processes its input twice or more. It disables some commands during the trial processing, but it forgets to do it for \stepcounter and \addtocounter. One of the commands it disables is \write, with the consequence that the \vspace is added but the message is not issued. \documentclass{article} \usepackage{tabu} ...

4

biblatex warns you if the bib is empty. You could redefine the command used for the message \blx@warn@bibempty: \usepackage{biblatex} \makeatletter \def\blx@arn@bibempty{Try it out} \makeatother

3

The \ifthenelse test does a token-based comparison. Thus when you do \documentclass{article} \usepackage{ifthen} \newcommand{\foo}[1]{% \ifthenelse{\equal{#1}{\string german}} {TRUE} {FALSE}% } \begin{document} \foo{german} \end{document} what happens is that \string is applied to the first token it sees, in this case a g. Comparing the two ...

3

According to Ulrike Fischer's comment \jobname consists of 'wrong' catcode characters, a direct comparison is not possible with some hacks. One workaround is to write the jobname to a dummy file and read it immediately back to some \def\.... macro, say \RealJobName. This can be used as one string placeholder for the tests. The \AtBeginDocument{} ...

2

The characters in \jobname have category code 12 and this defies substr, which uses an \ifx based comparison. You can simply stringify student, using the fact that substr commands fully expand their arguments: \documentclass[ngerman]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[ngerman]{babel} \usepackage{substr} ...

2

You can collect the cell entry using collcell and condition on it's value with a basic \ifnum TeX condition: \documentclass{article} \usepackage{collcell,array,xcolor} \newcommand{\formatcolentry}[1]{% \ifnum#1<10 \color{red}% \else\ifnum#1>30 \color{green}% \fi\fi#1} \begin{document} ...

2

The expression \pgfmathsetmacro\polar{ ifthenelse(\Sx=0 \AND \Sy=0 \AND \Sz=0, 0, acos(\Sz/(sqrt(\Sx^(2) + \Sy^(2) + \Sz^(2)))))} has several errors. The ifthenelse keyword implemented by pgf has a different syntax from the \ifthenelse macro from the ifthen package. You seem to be trying to mix the two, hence the issue. For the ifthenelse ...

2

The problem in your code comes from the way you use \equal. Instead of having \x\equal{#1}{true}, you should use \equal{#1}{\x}. Note that \equal is case-sensitive, and some converting should be used if you need the filename lowercased but the displayed name starting with an uppercase. The menukeys package provided by Tobi is indeed of interest in your ...

1

I prefer \def\something{} \ifdefined\something True \else False \fi to avoid the ifthen package. The advantage of not using a package is that this approach can be used in files that are just \input by large document (for example TikZ images), when it cannot be guaranteed that a certain package is loaded.

1

I identified a working strategy that solves part of the problem. The common useage of this command is "\rput[refpoint]{rotation}(x,y){stuff}". "refpoints" determines the reference point of stuff. It take value of the combination of "t,b,B"(for vertical refpoint, means "top","bottom" and "Baseline" respectively) and "l,r"(for horizontal refpoint, means ...

Only top voted, non community-wiki answers of a minimum length are eligible