Questions tagged [renewcommand]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
3 answers
41 views

How to escape characters within variables used in command definitions?

I want the doi part of my references (in APA style) to look like this: doi: <hyperlinked doi> To achieve this I've added the command \renewcommand{\doi}[1]{\href{https://doi.org/#1}{#1}} after \...
0 votes
2 answers
29 views

How to use the section command and keep a clear table of contents?

I want to change the section formatting to a longer one but the table of contents has it overlapping with the section. How can I fix this? \documentclass{article} \usepackage[utf8]{inputenc} \...
2 votes
2 answers
67 views

New Command with carriage return

Good morning everyone! Still for my theater script template, I created the \move command for captions, but I can't set the carriage return (see figure). However, the text must keep in line with the ...
  • 105
0 votes
0 answers
23 views

equation + tag + numbering [duplicate]

how to add a equation with a comment using command \tag without having it overriding the automatic numbering? i have already tried renewing the equation env but I need to be able to add different ...
0 votes
1 answer
33 views

Admissible characters for commands

I am writing a small python script that does some magic (will post it on github when ready). I need to search through my .tex file commands. They way I implemented it so far is that the script looks ...
0 votes
1 answer
40 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
1 answer
27 views

How to make a document with figures and schemes

First at all, sorry for my english, im colombian. Im a Chemistry student, in my thesis I need put in that two types of images, "figures" and "schemes", and their respect \listof... ...
2 votes
1 answer
37 views

How do I make endfloats and appendix table numbering work together

I am trying to make LaTeX do two things, both of which work in isolation, but not together. My desired result is a main text followed by bibliography and all tables and figures numbered normally, ...
0 votes
1 answer
32 views

how to make V. for versicle indented and in red

I am typesetting an Orthodox liturgical text and would like to typeset a versicle (V.) before certain verses. I am currently using the following: \documentclass[12pt]{article} \title{Orthodox ...
  • 1
1 vote
4 answers
101 views

How to properly create a command that takes a variable amount of arguments?

I tried to create a command that concatenates multiple strings together. The first source defines a new command \merge that takes two parameters and prints them without any spaces between them. The \...
1 vote
1 answer
152 views

How to avoid syntax error highlights on Overleaf with redefined meaning of \[, \], \(, \) commands? [closed]

I want to overwrite the commands listed in the title with \renewcommand{\(}{\left(} ... \renewcommand{\]}{\right]} I already tried it in Overleaf and when I click 'compile' it compiles ...
0 votes
0 answers
18 views

How to change $\epsilon$ to $\varepsilon$ while preserving $\epsilon$ in another command? [duplicate]

For most of my purposes, I use \varepsilon, so I have a \renewcommand{\epsilon}{\varepsilon} in my personal .sty file. A recent homework problem in my numerical calculus class has meant that I would ...
0 votes
0 answers
17 views

How can I set the numbering parameters for subfigures back to default?

Please I did change the numbering parameters for subfigures using: \newcounter{row} \makeatletter \@addtoreset{subfigure}{row} \makeatother \renewcommand{\thesubfigure}{\alph{row}.\arabic{subfigure}} ...
2 votes
2 answers
121 views

How redefine \subsection*?

How can \subsection* (the starred version) be redefined so as to do exactly what \subsec does in the following? (Note that I will not be using the unstarred \subsection.) \documentclass{memoir} \...
  • 6,828
0 votes
2 answers
27 views

Renewenvironment multicols

I have a larger document in which the text is often set in columns with multicols. Now I have to remove the columns for the print layout and would like to redefine the multicols environment. ...
  • 11
0 votes
2 answers
61 views

Using hyphen as a letter in command names

I am using hyphen as a letter for command names. But I allow users to rename them if necessary. Then use \catcode`-=11. Suppose I keep the hyphen as a letter in command names, I wonder if users ...
  • 337
1 vote
1 answer
28 views

Syntax: use second argument leaving the first argument as default in a macro

I use this command to abbreviate my notation \NewDocumentCommand{\Lp}{O{p}O{\mathbb{R}^d}O{[- \infty, \infty]}}% {L^{#1}(#2, #3)} I've set one default for each argument, in most cases I need just ...
  • 69
3 votes
3 answers
52 views

Command and counter for chemical equations

I want to define a command for chemical equations, using the mhchem package. The objective is to obtain this: A + B = C (R1) C + D = E (R2) Following the mhchem manual this should be ...
  • 178
0 votes
0 answers
24 views

RenewCommandCopy raises an error with leavevmode

Why I get an error with \RenewCommandCopy and \leavevmode? How can I fix it? But with \def I have no error. \documentclass{article} \newcommand{\foo}{Something} \NewCommandCopy{\originfoo}{\foo} \...
0 votes
0 answers
42 views

Can I define two exact same commands using /newcommand with the only difference is one is lower case and the other is upper case

In my macro file, I have defined two commands \newcommand{\SO}[1]{\mathsf{SO}(#1)} \newcommand{\so}[1]{\mathfrak{so}(#1)} There are two exact same commands with the only difference is in case. When I ...
4 votes
2 answers
343 views

How can I temporarily change of end of a proof symbol which looks like $\square$ to $\triangle$?

I want to temporarily change the end of a proof symbol which looks like $\square$ to $\triangle$, a triangle symbol for a particular proof of a particular theorem, while for other theorems in the ...
  • 259
0 votes
1 answer
38 views

Redefine a command together with particular arguments

For example, I would like to replace all \hat{N} by \widehat{N}, but leaves \hat{#1} unchanged for #1=anything else. I wish to implement it at macro level, and not replacing the text in the document, ...
  • 165
0 votes
1 answer
28 views

Alignment problem when redefining the table of contents (toc)

I want to redefine the table of contents like this: \documentclass[a4paper,10pt]{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[french]{babel} \renewcommand\thesection{\...
1 vote
2 answers
47 views

Use bold font for just the hat in math mode

I am using the libertinus font which also has math support. But when I try to place a hat on variables in this font, it seems too "flimsy." How to make the hat appear thicker? I tried ...
  • 13
0 votes
0 answers
51 views

How to put everything in front of \begin{document} in a separate file?

So as I am doing a lot of similar documents I tend to always use the same preamble for all of my documents. But as I sometimes add new commands, it gets a little iffy to always remember which document ...
  • 189
0 votes
1 answer
21 views

Create hyperref form fields with macro

I would like to create a macro that will help me configure hyperref form fields. Can someone tell me why my minimal example does not work? \documentclass{article} \usepackage[margin=1.25cm]{geometry} \...
  • 337
2 votes
1 answer
61 views

A macro that takes in a variable that is a number, interprets it as a string, check if it has a plus sign, removes it, then stores it to the variable

I want to create a macro \foo that takes in a \newcommand variable that is a number, e.g., \bar where it's defined as \newcommand{\bar}{<number>} and interprets it as a string, then checks if ...
0 votes
1 answer
57 views

Renew \[ and \] commands into something more convenient

I'm trying to renew \[ and \] in such a way that it is the same of writing \begin{equation*} \begin{split} \end{split} \end{equation*} I remember a question in TEX SE that contained an attempt in ...
  • 69
1 vote
3 answers
74 views

is the following conditional macro possible in latex?

I have a simple macro that I want to define as \newcommand{\myalert}[1]{\textcolor{red}{ALERT: #1}} However, I want to have a conditional such that if #1 is one of two strings (say "noalert"...
  • 9,150
0 votes
1 answer
64 views

How can I (re-)define language-specific commands (XeTeX, polyglossia)?

When I first wrote a very large document with pdfTeX and babel, I defined two commands for (ancient) Greek only: Linebreak is allowed after \,: \addto\extrasgreek{% \RenewDocumentCommand\,{}{\...
9 votes
2 answers
248 views

Why does \newcommand{\do}{do} not work? [duplicate]

I'm trying to define a command \do in LaTeX, but for some reason, it does not show up. Why is this? MWE: \documentclass{article} \newcommand{\do}{do} \newcommand{\doo}{do} % Dummy command for ...
0 votes
1 answer
26 views

Pass parameters in the new command so that it can be utilized in the whole document

I want a define a new command so that once I pass the value as ANNEXURE-I it should be right aligned, bold, underlined, and the font should increase. Moreover, I want the whole document to be ...
  • 85
0 votes
0 answers
31 views

Argument of \cvskill has an extra } when trying to override an existing command

I'm using the moderncv package which already defines the \cvskill command. I'm trying to override/redefine this command with \renewcommand: % ... % param 1: name of the skill / tech / etc. % param 2: ...
  • 101
1 vote
1 answer
45 views

How to redefine the same command differently over multiple theorems

i was wondering if there was a way to renew the emph command for each new newtcbtheorem you define. I have the following code already, adapted from an older solution by user egreg. The goal is to ...
1 vote
1 answer
137 views

Create new command for a specific font style

How can I make a new command of {\fontfamily{qcr}\selectfont <text here>} I have worked before with \renewcommand for mathematical formulas but I'm not sure how to do it with text formatting.
3 votes
5 answers
648 views

Easy way to convert \command{x}{y} to \command{x,y}

This is certainly a duplicate but I cannot find a straightforward and simple conversion method. Is there a universal way to convert \command{x}{y} to \command{x,y} ? (The question is general, this is ...
1 vote
2 answers
88 views

Use libertine math font just for the complexity package

I'm currrently using the complexity package, where I have defined a lot of new commands for complexity classes, and I'm writing my document using the libertine font. I want to use the regular math ...
0 votes
1 answer
267 views

LaTeX Error: Command \authorname already defined. Or name \end... illegal, see p.192 of the manual

I have the following source main.tex whose content is empty excepted the first cover page : %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Masters/Doctoral Thesis % LaTeX Template % Version 2.5 (27/8/17)...
0 votes
0 answers
28 views

Command to save all settings to get it back later

Is there a command which save all current settings in my document (like margin size for example) so that I can use it after I apply some changes? For example I would like to change some things in a ...
  • 241
1 vote
0 answers
49 views

Create an enumerated list with dotfill after every item

I'm trying to achieve a enumerated list with a \dotfill after every item to create a 'fake ToC'. But what I'm currently ending up is the dots before the item, not afterwards. \usepackage{enumitem} \...
  • 113
3 votes
2 answers
246 views

How can I renew the macro "\log" (from "log" to "\ell og")?

How can I renew the macro "\log" (from "log" to "\ell og")? Default function \log in line 1 I use renewcommand for \log: \renewcommand{\log}{\ell\text{og }} That shows ...
0 votes
1 answer
63 views

If else command

Why is the below code not working? I tried also renewcommand instead of def. The counter/\setcounter does not provide the value of the width which is why I stopped using it. Any idea of how to fix ...
0 votes
0 answers
33 views

Printing command in latex [duplicate]

I have installed new package which has a command "\mysteryCommand". It doesn't quite do what I'm looking for. How do I dump this command's actual text? I can find documentation and help me ...
1 vote
1 answer
61 views

Make textsc insensitive to environment

I'm using textsc inside an equation that then appears in a Theorem environment. I want the text in textsc inside the equation to appear in regular font, not italics (which is enforced by the Theorem ...
0 votes
0 answers
43 views

How to define *and* redefine in class file?

I'm creating a resume and have create my own custom resume class (doesn't everybody?). I have multiple positions that I want to typeset so I have something like this: \documentclass{mcv} \begin{...
  • 9,712
0 votes
0 answers
224 views

a verb=xxx_== problem with newcommand - missing $ inserted

\documentclass[12pt,a4paper,UTF8, scheme = plain]{ctexrep} \usepackage{amsmath,enumerate} \usepackage{geometry} \usepackage{adjustbox} \usepackage{booktabs} \usepackage{fancyhdr} \usepackage{lastpage} ...
  • 545
0 votes
1 answer
27 views

Acronym placement in text and period

I would like to define, an acronym that I can recycle in my text. E.g., \def\JB {\selectfont\texttt{J.~}-\texttt{Bond}}} The problem is that, In the beginning or in the middle of the sentence, I'd ...
2 votes
1 answer
91 views

How to change an environment in its body

I have the below code. \documentclass{article} \newcounter{ex} \newenvironment{ex}{% \par\noindent\refstepcounter{ex}{\bfseries Ex \theex.\, } }{} \...
0 votes
2 answers
65 views

How to apply contour for all content in the document output?

\documentclass[12pt]{book} \usepackage[letter, total={5in, 10in}]{geometry} \usepackage{amsfonts, amssymb, amsmath, amsthm} \usepackage[T1]{fontenc} \usepackage[outline]{contour} \usepackage{xcolor} ...
3 votes
1 answer
70 views

Non integer number in setcounter (report document): \setcounter{figure}{1.14}

I'm wondering how to write a non integer number inside the setcounter command. I'm writing a report so the numbers of the figures are not 1, 2, 3, but 1.1, 1.2, 1.3 (in chapter 1). I tried the command ...