Questions tagged [renewcommand]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
41 views

Redefinition of \maketitle is ignored

I would like to change some elements of my title page, but without completely creating my own titlepage environment (as e.g. demonstrated here), because I am using commands like \extratitle and \...
  • 191
1 vote
1 answer
53 views

Macro to conditionally generate tikz-cd diagrams

I'm trying to define a macro that will generate a tikz-cd diagram with small changes in it based on the arguments I pass to the macro call. I'm using xstring package to express conditions. My first ...
  • 13
2 votes
2 answers
75 views

Defining a command that adds a letter to another command

Suppose I have defined two commands, e.g. \newcommand{\commandA}{\alpha} \newcommand{\commandAB}{\alpha^2} I would like to define a command that makes \commandA into \commandAB by simply adding the ...
0 votes
0 answers
16 views

Trick with lineno on both sides can't be "compiled-out" via ltxcmds [duplicate]

Some time ago I took the solution from this answer to show lineno's line numbers on both sides of the page. However, I want numbers to be in place only sometimes (say when I need to send the document ...
  • 2,413
0 votes
1 answer
38 views

How to change quote behavior?

I'm using Org-Mode to write documents that I export to LaTeX. Org-Mode exports its quote blocks to: \begin{quote} ... \end{quote} In order to color these quotes I'm using the following code (found ...
1 vote
0 answers
9 views

Foreword, Appendix headings formatting in poemscol

I'm trying to change the font size, style and place a rule under two (2) sections in a poetry collection using poemscol. My desired result is a centered title with a rule underneath the width of the ...
0 votes
1 answer
31 views

Short-cut command for Bold face number

I often use short-cut command for bold-face letter such as \def\ba{\mathbf a} \def\bA{\mathbf A} \def\bb{\mathbf b} \def\bB{\mathbf B} ... which allow us to use $\bA$ instead of $\mathbb{A}$ ...
0 votes
0 answers
31 views

Define custom command which captures whole paragraph

I am using the exam document class. It has commands like \question which operate inside the environment questions. Within the document, you can write things like \begin{questions} \question Here is ...
0 votes
2 answers
55 views

Chapter only in TOC not in body of document

Is there a renew command or similar for chapter so I can suppress the chapter name from showing up in the body of the document, but does show up in table of content? This is the closest I got, but ...
  • 13
0 votes
2 answers
75 views

remember, call original, and restore macro when renewcommand

Suppose you want to temporarily redefine a macro in which you use the original. Is there a general recipe to remember the original definition, use the original in the temporary one, and restore the ...
  • 737
0 votes
1 answer
42 views

New command based on hyperref cannot handle special input characters

My goal is to add a heavy underline to text that contains hyperlinks via the hyperref-package, such that, when printing out the file, one can see that there is a link hidded behind some words. When ...
  • 635
1 vote
1 answer
22 views

How can I adjust the position of marginnote? (A \newcommand question)

I have a small script that lets me have footnotes in the margin. It works as I want it, except that sometimes it overlaps, or if it's near the bottom of a page, the note will be clipped. Using the ...
  • 133
1 vote
0 answers
43 views

How to display a list of all user made newcommands and what they do?

I am writing my bachelor thesis and I am introducing more and more newcommands, but I tend to forget them. Is there a way to display all user created new commands, like a make a list or a table? I ...
1 vote
2 answers
61 views

reuse macro for in-text equations using arguments

I am defining a macro for an equation that I use several times in my manuscript. However, I am reaching the point where I have two almost identical macros for the denominator and numerator of my ...
3 votes
1 answer
59 views

How to change the item bullet to square given in the below image?

\documentclass[12pt]{article} \usepackage{amsmath} \usepackage{amsfonts,amssymb} \usepackage[top=0.5in, bottom=0.5in, left=0.5in, right=0.5in]{geometry} \usepackage{enumitem} \usepackage{graphicx} \...
1 vote
2 answers
49 views

How can I adapt the dimension of the symbol "|" in the displaystyle math mode, without using \left | \right. (or viceversa)?

I have to write the symbol for conditional probability "|" but I want to adapt it to the dimension of the sorrounding text in the displaystyle math mode. The only way I know to do it is the ...
6 votes
3 answers
215 views

How to create a variable with parameters just like \title or \author?

Explaining what I want with Java: String myTitle = ""; // Later on in the main method myTitle = ""; System.out.println(myTitle); I basically just want to create a new variable ...
user avatar
4 votes
1 answer
79 views

How to change \tablename after \begin{document}?

I am writing an article in LaTeX for a Frontiers journal with MiKTeX. Their documentclass (frontiersin.org/design/zip/Frontiers_LaTeX_Templates.zip) defines \tablename as Table. I would like to change ...
0 votes
1 answer
28 views

Missing } inserted.for `algnewcommand ` in AMA document class

I am trying to prepare a paper for Concurrency and Computation: Practice and Experience, its latex class files could be find here: https://onlinelibrary.wiley.com/page/journal/15320634/homepage/...
  • 1,175
3 votes
1 answer
176 views

new command of a math expression $^{\circ}$C

I frequently use $^{\circ}$C for writing the degree celsius unit. Now I would like to make this into a command like \deg, \degree, \celsius, or any suitable command that is not already taken of course....
1 vote
1 answer
28 views

How to keep some text non-italic in the theorem environment?

I have this preamble \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[left=1in, right=1in, top=1.3in, bottom=0.8in]{geometry} \usepackage{amsmath} \usepackage{amsfonts} \...
0 votes
0 answers
35 views

Each new paragraph has it first letter or word in large size automatically

im using latex mainly for not taking and thought that if i could make each first word of each new paragraph in LARGE size would help me read through the notes later so i'm thinking of creating new ...
1 vote
2 answers
104 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
32 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
72 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
25 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
35 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
50 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
32 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
43 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
40 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 ...
  • 29
1 vote
4 answers
135 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
171 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
21 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
18 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
170 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} \...
  • 7,370
0 votes
2 answers
33 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
70 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
32 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 ...
  • 79
3 votes
3 answers
60 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
37 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
43 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
394 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
40 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
35 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
85 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
70 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 ...
  • 199
0 votes
1 answer
22 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} \...
  • 347
2 votes
1 answer
64 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
61 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 ...
  • 79