Hot answers tagged

9

Some remarks: "Long" arguments with paragraphs (\par tokens) can only be used for macros, which are defined with \long: \long\def\macro. This is the default for \newcommand. \setpage needs to be defined this way. \callpage, however, should not allow \par tokens, which are forbidden in \csname. It can be defined by \def or the star form \newcommand*. Since ...


6

You're wrong in thinking that \def is shorter. Maybe it looks shorter by number of characters, but it can save you from pulling your hair when some weird error shows up. Suppose you load a package you use only some features of, but that this package uses a macro named \setpage as part of its working when the feature you exploit is called. Can you see what ...


4

Keep the tests out of your document body: \documentclass[12pt]{book}% \usepackage{amsmath} \ifdefined\HCode \newenvironment{myequation} {\begin{equation}}{\end{equation}\ignorespacesafterend} \else \usepackage{breqn} \newenvironment{myequation} {\begin{dmath*}}{\end{dmath*}\ignorespacesafterend} \fi \begin{document} \begin{myequation} ...


3

If you add \global\cslet{lied;#1;#2}\test \show\test you will see that \test and so lied;..;.. is defined as > \test=\long macro: ->{\Author \temp }. but \Author and \temp are only locally defined so not defined outside the group, where you try to use this. I couldn't work out the intended behaviour, but this is error free. ...


3

The problem is the catcode of @: \newcommand{\generateFixBox}{ \makeatletter \def\@oddhead{% \setlength\unitlength{1mm}% \begin{picture}(0,0)% \put(120,-250){\fbox{B}}% \end{picture}\hfill} \makeatother } At definition time, \makeatletter is not executed, but the definition text is already tokenized. Therefore the input text ...


2

Not exactly as you suggested, but \newif is a simple solution. Your A and B environments replaced by exemplary theorem-like ones. Edit: enlarged, according to suggestion from comment. The old picture left. \documentclass{article} \usepackage{amsmath} \begin{document} \def\myVariable{ whatever I want goes here } %tell Latex not to look at it Now I ...


2

I think you want something like this: \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \keys_define:nn { maag/variables } { unknown .code:n = \maag_defvar:Vn \l_keys_key_tl { #1 } } \NewDocumentCommand{\newfamily}{mm} { \prop_clear:N \l_maag_family_prop \keys_set:nn { maag/variables } { #2 } \prop_new:c { g_maag_family_#1_prop } ...


2

Basic option would be my_rows.tex with \rowdef{row_complex}{\arow{this}{is}{a}{nastyyyy}{$\mathcal{C}$ row}} \rowdef{row_real}{\arow{this}{is}{a}{less nasty}{$\mathcal{R}$ow}} Then adding in the preamble \newcommand*\arow[3]{#1&#2&#3\tabularnewline} \newcommand*\rowdef[1]{\expandafter\def\csname row@#1\endcsname} \newcommand*\rowuse[1]{\csname ...


2

You need to remove the \[ and \] in the macro definition. Otherwise when the macro \test expands, it'll introduce a display math environment \[...\] within an in-line math environment $...$, which throws an error. Code \documentclass{article} \newcommand{\test}[2]{\log_{#1}#2} \begin{document} Expected result:$\log_{(\log_{a}{b})}{c}$ ...


2

there are several problems with your code. first, you need \makeatletter and \makeatother at the outer level so that the @ is properly recognized in the command names. and then, these are not needed inside the definition of \generateFixBox. second, in the definition of \generateFixBox, a closing brace is missing to complete {\fbox{B}. the result gives a ...


2

you can use \scrollmode or \batchmode so that TeX does not stop on errors but it would be a really bad idea to do so. The class should simply predefine constructs like \author if you have \def\author{your name goes here} in the class then you get that text unless the user sets author, or you could instead have \def\author{\ClassWarning{MG}{author name ...


1

Put the mouse on the PDF that is open by texstudio, then RIGHT-CLICK the mouse. This open a window like this: Which is on top of the PDF, like this click on the "Go to Source" To go from Source to PDF, put the mouse on the source file open, and RIGHT-CLICK, this will open a menu like this: Click on the Go to PDF to go the PDF file location of the ...


1

Macros and keysettings are part of the profile. There is currently no way to handle them separately.


1

You can't make this work; the settings such as \setAuthor must be evaluated before \BODY is expanded for being stored in the lied macro. You can add a third argument where making the settings. But you're probably using a wrong approach: a key-value one would be better. \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} ...



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