Questions tagged [renewcommand]
The renewcommand tag has no usage guidance.
213
questions
0
votes
3
answers
109
views
How to replace the argument of the command that is already defined?
I use \textcolor in the color package to add some colors (red, blue, orange. etc) to the string.
For example, like this
This is \textcolor{red}{test}.
This is \textcolor{blue}{test}.
I would like ...
0
votes
1
answer
49
views
Redefine \marginpar with \renewcommand gives infinite loop
I want to redefine \marginpar to include a counter for how much space in the margin is already used. This counter is later used in \marginbarrier (with an argument of how much space to reserve in the ...
0
votes
1
answer
43
views
How to create an alternate version of the \subsection command that clears one page instead of two and uses a different syle for the page?
I'm trying to define an alternate version of the \subsection command, but this error keeps preventing me from compiling.
I'm using TexStudio with a LuaLatex compiler.
This is the command's syntax:
\...
0
votes
1
answer
27
views
How to write a newcommand with \hrulefill which I can control like \fillwithdottedlines{} in exam class
I am currently using book class to prepare learner's write in workbook as in MWE below:
\documentclass[openany]{book}
\newcommand*\myblank{\\[2ex]\hrulefill\\[2ex]\hrulefill\\[2ex]\hrulefill\\[2ex]}
\...
2
votes
2
answers
146
views
change the appearance of the equation by several levels
I use this code to change the appearance of the equation, but it is full of errors even if at the end it gives a result, please help me to correct it. Thank you .
\documentclass{article}
\usepackage{...
0
votes
0
answers
25
views
How to personalize the style of a comment?
I want to create a comment which is removable. Therefore I'm using the comment package, but I want to change the style of the comment to make it more visible, like this :
And, this is my code (I ...
0
votes
1
answer
94
views
renewcommand{\dot}[1]{} does not work because of fontspec package
Solved. See Answer.
I would like to replace the default symbols of \dot{} and \ddot{} with the ones shown in How to make a larger "\dot" while the commands remain the same.
I've tried the ...
3
votes
3
answers
367
views
How to make a command completely null
How does one redefine a command to ignore all parameters, and not do anything?
Suppose for example that I want to represent the results (of a binomial) in two different ways and then at the end to ...
0
votes
1
answer
31
views
New command optional arguments for sub, supra, and argument of an operator
I'm trying to specify a command that allows to display an operator, its evaluation at a certain argument, and add sub and supra indexes. That is, the commands
\f
\f{a}
\f{a}{i}
\f{a}{i}{j}
Should ...
0
votes
0
answers
21
views
Modify randomizechoice environment
I have this code where \addChoice and \addCorrectChoice do some additional operations in the checkboxes environment.
\let\origcheckboxes\checkboxes
\let\endorigcheckboxes\endcheckboxes
\...
2
votes
2
answers
219
views
Renew command in section and subsection
How do I change a section and a subsection to have something like this:
A) A.i) A.ii) B) B.i) B.ii)
I tried with \renewcommand:
\renewcommand{\thesection}{\Alph{section})}
\renewcommand{\thesubsection}...
0
votes
0
answers
18
views
\renewcommand for adding letter to section not working properly [duplicate]
I am using \renewcommand{\thesection}{S\arabic{section}} to add S to all the section numbers. This works well as long as the number is a single-digit (1-9), both in the document and the ToC. Once it ...
3
votes
2
answers
199
views
Italicizing a Lettrine on an Ad Hoc Basis
Consider the code:
\documentclass[12pt]{book}
\usepackage{lettrine,xcolor}
\renewcommand{\LettrineFontHook}{\color{red}{}} % for the initial argument.
\renewcommand{\LettrineTextFont}{\scshape} % for ...
0
votes
1
answer
39
views
Create static variable inside of \pgfplotstableset definition
I try to understand, how to create a variable inside or outside of the \pgfplotstableset environement which is static and will not be resetted all the time.
Probably this is a generic question for ...
0
votes
0
answers
41
views
Math MCQs, arranging the given choices, the space between them, and some other (automatic) formatting
I am a new user of Latex, I only can write equations like in MSE, and never made a document in latex before.
I wanted to create MCQs, but MicrosoftWord is not better than Latex for this purpose, where ...
3
votes
1
answer
300
views
How to create a custom command (control sequence) with special characters in its name
I want to create a custom command (control sequence) whose name contains special characters (such as numbers, underscores _, or -). In order to better distinguish different commands, my code is as ...
0
votes
3
answers
32
views
Identifying definition and theorem counters halfway through document
I am currently creating a latex article for a large-scale assignment for a class. In it, the numbering system for the definitions and theorems needs to change halfway through the document. In one ...
0
votes
2
answers
41
views
Default not working for new command
\newcommand{\initialize}[2][tmargin=1in, bmargin=1in, right=0.75in, left=0.75in]{
\geometry{#1}
\ifthenelse{\equal{#2}{}}{\setboolean{indent}{false}}{\setboolean{indent}{true}}
\...
0
votes
1
answer
118
views
\newcommand syntax with callouts
I suspect I am just missing something minor, but thought perhaps someone could assist.
I am using a Markdown file with the Eisvogel template. I am using both awesomebox and fontawesome5 packages to ...
1
vote
1
answer
34
views
How to change column width for particular row of table
How can I set this layout?
I have made this but it did not work
\begin{table}[H]
\caption{Current state-of-the-art approaches in UAV fault detection techniques.\label{tab:2}}
\begin{tabularx}{\...
0
votes
1
answer
38
views
"\renewcommand{\tilde}{\widetilde}" doesn't take affect in ctexbook class
I want to redeifne \tilde to \widetilde. However, it doesn't take affect.
\documentclass{ctexbook}
\renewcommand{\tilde}{\widetilde}
\begin{document}
$\tilde{A}\widetilde{A}$
\end{document}...
0
votes
0
answers
21
views
Modified \listoflistings don´t show listings on Table of Listings . Package Minted
I have a problem using a redefined \listoflistings command to generate a table of listings for my thesis on a template based on a previous version of puthesis.cls. I need to generate a list of ...
0
votes
0
answers
61
views
Redefine Figure (or Table) as "Supplementary Materials Figure (or Table)"
I am preparing some Suppementary Materials for a manuscript, and they say that I need my Figures in the Supplement to be called "Supplementary Materials Figure 1" (say). Now, I know how to ...
1
vote
0
answers
101
views
Re-definition of a command inside an environment [closed]
The redefinition of a command inside an environment works fine if the redefinition makes no use of the arguments,
but it fails if the arguments are used in the new definition.
the error message is :
...
0
votes
2
answers
79
views
How do you create a variadic new command?
The word "variadic" is used for functions, and commands, which can accept any number of input arguments.
Below, we see an example of a custom command which has three inputs:
\newcommand{\...
0
votes
0
answers
23
views
Moderncv subentry with indented multiline text
I want to add some kind of subentry related to, e.g., a project within a work position. I came across a similar question whose answer I tried to solve my problem. However, if the bold entry exceeds ...
0
votes
1
answer
65
views
How can I redefine the style of the \lstlistoflistings title?
I am using a cls based on memoir and the package listings.
I want an appendix chapter with all the lists (list of tables, list of figures, list of listings). The title style of these lists should be ...
4
votes
1
answer
329
views
How to get rid of \def
I was recently required by a journal to getting rid of \def in the definitions of my personal macros. It turns out to be not-so-easy and the naive replacement of \def by \newcommand does not always ...
2
votes
4
answers
360
views
Leaving blank arguments in a new command
If I am using this simple new command...
\newcommand{\Lem}[3]{
\begin{lemma}
{#1}
\begin{itemize}
\item{#2}
\item{#3}
\end{itemize}
\end{lemma}
}
how can I use it if for example I only have one item ...
2
votes
1
answer
73
views
Trouble with renewing a command twice
I wish to make a list enumerated with colored numbers. The way I found is to renew the \labelenumi command used by the enumerate environment to label items. However, I want to be able to switch back ...
0
votes
0
answers
26
views
Treat subsubsections differently when referencing [duplicate]
My document numbers chapters and sections like this:
1. Chapter
1.1 Section
1.1.1 Subsection
Subsubsection
For the first subsection \subsection{First}\label{subsec:first}, for example, ...
3
votes
1
answer
81
views
How to keep the original phi command with another name?
Since I don't usually use the "original" phi I have the following code in my preamble:
\renewcommand{\phi}{\varphi}
However, I'm now in a situation where I really need the "original&...
0
votes
0
answers
71
views
Starting command using “/“ instead of “\”
This seems like a very random question, but I just got the Apple Magic Keyboard for iPad Air 5th generation. The key “\” is half of the size of that of “/“. The “\” key is placed also in the edge and ...
2
votes
2
answers
125
views
draw a isosceles triangle using angles tkz
I have this \newcommand to draw an isosceles triangle, is there a way to alter this so instead of creating a point D and the circle AB to find C, use AB and an angle to get C and keep AB=AC.
\...
2
votes
1
answer
219
views
Different definitions of commands in different chapters with subfiles
I have a LaTeX project which I've created using subfiles which contains several nested directories. Each of the directories other than the bottom-most one in the hierarchy contains a main.tex file ...
2
votes
2
answers
174
views
Command name containing a number
I want to define a command \C4 which produces C4 (both in bold and normal fonts). I wrote something like
\begin{document}
\DeclareTextFontCommand{\textscn}{\upshape\bfseries}
\newcommand{\C4}{\...
0
votes
0
answers
37
views
Label of a section with the same name of the section automatically [duplicate]
I'm wondering if there is a way to name the label with the same name of a section automatically.
In the below example, instead of writing \label{page1}, I'd like to write something like \label{...
1
vote
1
answer
25
views
It is possible to skip a chracter from fnsymbols?
I'm changing the marks of the footnotes using the following line of code, but I didn't want to use the asterisk as a mark.
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
Is possible to remove the ...
1
vote
1
answer
30
views
Minutes package: Change the preformatted texts in the maketitle segment
I want the \moderation{} command to display Chairman instead of Moderation. Is that possible?
Document class: scrartcl
Previously tried:
\renewcommand{\moderation}{Chairman} inside and outside of ...
0
votes
1
answer
64
views
Pass renewed commands by pdflatex engine
If I use:
\AtBeginDocument{\let\oldtableofcontents\tableofcontents
\renewcommand{\tableofcontents}{\oldtableofcontents\label{TOC}}
\let\oldmaketitle\maketitle
\renewcommand{\maketitle}{\oldmaketitle\...
0
votes
1
answer
201
views
Generating bubble answer sheet
I wish to adding bubble answer sheet in the following MWE:
\documentclass[twoside,a4paper,cleardoublepage=empty,14pt]{book}
\usepackage{exsheets}
\SetupExSheets[question]{type=exam}
\SetupExSheets{...
2
votes
0
answers
77
views
renewcommand ignored in caption
I have redefined a command to give me a negative sign that is more convenient for me. This works in all contexts except within a caption.
\documentclass{article}
\usepackage{amsmath} ...
2
votes
2
answers
362
views
How to simplify the code below by using cycles?
\documentclass{article}
\newcommand[3]{\mycounter}{a=#1, b=#2, c=#3}
\begin{document}
\mycounter{1}{2}{3}
\mycounter{4}{5}{6}
Too much… and the last line is
\mycounter{28}{29}{30}
\end{document}
I ...
3
votes
1
answer
82
views
Opacity not respected for tikz drawing if inside pgfplots' axis
I define a myDraw command that should draw two lines.
The command has an optional parameter.
If I don't pass this parameter, both drawings should be opaque.
Otherwise, the drawing specified in the ...
1
vote
2
answers
130
views
Verbatim environment in \newcommand
I want to make two commands for \begin{verbatim} and \end{verbatim} to make it shorter like this:
\newcommand{\bv}{\begin{verbatim}}
\newcommand{\ev}{\end{verbatim}}
I have already done the similar ...
0
votes
0
answers
24
views
names of commands that include numbers [duplicate]
I would like to use numbers in \newcommand names. Would this be possible ?
\newcommand{\p13}
{\geometry{paperwidth=13cm,paperheight=21cm}}
\newcommand{\p26}
{\geometry{paperwidth=26cm,...
0
votes
0
answers
50
views
Making command to add \left and \right to brackets that are within an equation block (within $$)
Just wondering if there is a way to replace the brackets - '(' and ')' within equations with '\left(' and '\right)' but not replace the brackets within general text.
For example, in the body of a ...
2
votes
1
answer
52
views
A command that would always place text at the beginning of the document
I am keeping something like a diary, that helps me keep track of things that I am working on. Occasionally there are some actions (To do's) that need to be taken, which I would like to keep on the ...
2
votes
3
answers
121
views
Create a macro to append elements to another macro
General overview
The goal is to make a list of photo credits at the end of a book.
MWE
\documentclass{article}
\newcommand\credittable{} % This command contain the final rendering.
\newcommand{\...
0
votes
2
answers
155
views
Can't change name of Abstract while using Babel
I am writing a thesis and I want to have two abstracts in different languages, English and Catalan. I started with a thesis template from my university (only in English) and then added the Babel ...