New answers tagged

1 vote
Accepted

Modifying a known titlesec macro for chapters for variable length rule

The last argument to \titleformat can be a command, to which the chapter title is passed as the last argument. So we can distinguish between numbered and unnumbered chapters. The “Chapter N” bit is ...
egreg's user avatar
  • 1.1m
1 vote

Modifying a known titlesec macro for chapters for variable length rule

Try this (simplified) code. (1) The length of the longest line of the chapter title is returned in \titlewidth. You must use the calcwidth package option. (2) The explicit package option allows using #...
Simon Dispa's user avatar
  • 38.9k
0 votes

Add space between horizontal line and text inside a table - LaTeX

Assuming you want to keep using \pbox directives, I can think of two solutions: (a) stop using \hline and start using \toprule, \midrule, and \bottomrule, three macros provided by the booktabs package;...
Mico's user avatar
  • 503k
1 vote

Add space between horizontal line and text inside a table - LaTeX

Instead of manually adding line breaks, you could use columns of fixed with, e.g. p{2cm} or use the tabularx package to automatically add line breaks: \documentclass[twoside, a4paper, 11pt]{article} \...
samcarter_is_at_topanswers.xyz's user avatar
3 votes
Accepted

How to correctly center my lines of math?

Here is a rewrite using siunitx \documentclass[a4paper]{article} \usepackage{amsmath,siunitx} \sisetup{ per-mode=fraction, group-digits = integer, } \begin{document} \begin{align*} \dot m &...
daleif's user avatar
  • 54.1k
1 vote

How to correctly center my lines of math?

\documentclass{article} \usepackage{amsmath} % for the align environment \begin{document} Finally: \begin{align*} \dot{m} &= \rho \cdot V \cdot A \\ &= 0.00347747 \, \frac{\text{kg}}{\text{s}}...
Paul A's user avatar
  • 933
5 votes

Realistic spiral binders with tikz

\documentclass{article} \usepackage[a4paper, hmargin=2cm, tmargin=4cm, bmargin=2cm]{geometry} \usepackage{lipsum} \usepackage{tikz} \usepackage{tikzpagenodes} \usetikzlibrary{shadings, fadings, ...
hpekristiansen's user avatar
0 votes

TikZ tree alignment with multiline node labels

As an alternative, you could use forest, which would allow you to format the leaves more easily. \documentclass{article} \usepackage{forest} \begin{document} \begin{forest} for tree={ parent ...
Sandy G's user avatar
  • 41.7k
1 vote

Recursive macros revisited

If you like brace-hacks: \documentclass{article} \usepackage{trimspaces} \makeatletter \@ifdefinable\@gobbletoquestionmark{% \long\def\@gobbletoquestionmark#1?{}% }% \@ifdefinable\question{% \...
Ulrich Diez's user avatar
  • 28.2k
0 votes

TikZ tree alignment with multiline node labels

With istgame: \documentclass[border=5mm]{standalone} \usepackage{istgame} \usepackage{makecell} \NewDocumentCommand\mline{O{c}+m}{\makecell[#1]{#2}} \begin{document} \begin{istgame}[font=\...
I. Cho's user avatar
  • 2,955
2 votes

Recursive macros revisited

The following is similar to @egreg's answer, but instead of breaking the input into a sequence and rebuilding a token list from that sequence it just works on the input directly via \tl_replace_all:...
Skillmon's user avatar
  • 59.5k
6 votes

Recursive macros revisited

I think your main mistake is \ifx#1 It's not clear what you intended to compare but \ifx compares tokens so here it is comparing A to b: it's never true if your first letter is upper case and your ...
David Carlisle's user avatar
6 votes

Recursive macros revisited

Sorry, but your code is wrong not only because of a missing termination. Let's see what happens with your call. From \test{Ab Bc Cd? Tm Br Sl? Kr Nd Zf?} we get \question Ab Bc Cd? Tm Br Sl? Kr Nd Zf?...
egreg's user avatar
  • 1.1m
5 votes

Recursive macros revisited

Your terminal condition is never reached (you're comparing #1 to a space if #1 is a single token, #1 is never a space, or the first two tokens in #1 if there is more than one), hence you get the error ...
Skillmon's user avatar
  • 59.5k
7 votes

Recursive macros revisited

It helps having a terminator to the data in this case \endq, because it eliminates the need to look ahead (perhaps with \futurelet) to find the end of the data stream. Also, a terminator in the ...
Steven B. Segletes's user avatar
0 votes
Accepted

Text on top of a formatting line

You get a more uniform appearance and can input the objects more easily if you define some local commands. \documentclass{book} \usepackage{tabularx} \begin{document} \begin{titlepage} % some local ...
egreg's user avatar
  • 1.1m
0 votes

Text on top of a formatting line

Perhaps one of the following solves your problem? The first is created using \underline. The second is created using \rlap. \documentclass{article} \begin{document} \hspace*{1cm}{\Large Teacher1: \...
Willie Wong's user avatar
  • 24.5k
0 votes

How can I create a fancy TOC with background colors?

It's not a good suggestion (also borrowed Sir Peter Wilson suggestion too), but it works partially: \documentclass[12pt]{article} \usepackage[table]{xcolor} \usepackage[hidelinks]{hyperref} \...
MadyYuvi's user avatar
  • 13.6k
2 votes

How can I modify LaTeX commands to center company/university names and make position independent of column length in resume headings?

You can use the commands \rlap, \clap, and \llap to collapse the items left, center, and right to zero width and then use \hfill to center. If any of the parts gets too long, it will overlap with the ...
gernot's user avatar
  • 49.4k
1 vote
Accepted

Vertical alignment (centering) not working (multirow, longtable, booktabs)

As supplement to to nice @cabohah answer (+1), but with use of tabularray package. Using its longtblr table the code is more clear and concise (shorter). Table has (to my opinion) more appealing looks:...
Zarko's user avatar
  • 296k
2 votes

Vertical alignment (centering) not working (multirow, longtable, booktabs)

The first mandatory argument of \multirow is the number of rows. Your table has multi-line table rows and also uses booktab lines. So the value 2 is to low. Increasing the number can help to improve ...
cabohah's user avatar
  • 10.8k
1 vote

Fix formatting for long numbered aligned equations

I suggest employing a multline environment and distributing the material across three rows. I would also get rid of the 18 [!] instances of \left and \right, as the instructions do nothing productive ...
Mico's user avatar
  • 503k
0 votes

Fix formatting for long numbered aligned equations

Use split: \begin{equation} \begin{split} P(x) & = \frac{(x - x_2)(x - x_3) \dots (x - x_n)}{(x_1 - x_2) (x_1 - x_3) \dots (x_1 - x_n)} y_1 + \frac{(x - x_1) (x - x_3) \dots (x - x_n)}{(x_2 - ...
myca's user avatar
  • 1
1 vote

How to define an environment for a boxed and named theorem?

I suggest you use \tcolorboxenvironment from the tcolorbox package. Then you can call the theorem with or without a heading as usual. \documentclass[11pt]{article} \usepackage{tcolorbox} \usepackage{...
mbert's user avatar
  • 4,086
1 vote
Accepted

How to avoid parentheses + brackets in the title in amsthm when only using \cite?

You can match the argument against a regular expression that represents \cite followed by zero or one occurrence of [...] and by {...}. \documentclass[10pt]{article} \usepackage[]{amsmath, amssymb, ...
egreg's user avatar
  • 1.1m
3 votes

Typing grave accent for double quotes

You want upquote. \documentclass{article} \usepackage{upquote} \begin{document} \verb|``test''| \begin{verbatim} ``verbatim does not show the actual symbols'' \end{verbatim} \end{document}
egreg's user avatar
  • 1.1m
0 votes
Accepted

Typing grave accent for double quotes

Thank you guys for the help! Following a (different) suggestion, I arrived to this solution: \`{}\`{} text \textquotesingle\textquotesingle which is based on what I found in this other question. It'...
Laura F.'s user avatar
  • 116
2 votes
Accepted

How to add additional captions to the left side of each row?

I also made some gratuitous formatting changes. Note that \label does not work with \caption*. \documentclass{article} \usepackage{subcaption} \usepackage[export]{adjustbox}% for valign \usepackage{...
John Kormylo's user avatar
  • 79.3k
3 votes

Typing grave accent for double quotes

You may want to switch to LuaLaTeX, which does not "beautify" the symbols in verbatim mode. % !TEX TS-program = lualatex \documentclass{article} \begin{document} \begin{verbatim} ``Under ...
Mico's user avatar
  • 503k
6 votes

Vertical spacing in tcolorbox

You could use \strut to ensure that your text always has the maximum height and then reduce the top and bottom margins as you want: \documentclass{article} \usepackage{tcolorbox} \newtcolorbox{test}{...
samcarter_is_at_topanswers.xyz's user avatar
1 vote
Accepted

No indent inside tcb theorem

Remove the key parbox=false. \documentclass{book} \usepackage[dvipsnames]{xcolor} \usepackage{geometry} \usepackage{amssymb} \usepackage[many]{tcolorbox} \newtcbtheorem[number within=section, list ...
mbert's user avatar
  • 4,086
0 votes

leave an inch by inch margin -- top right

It is easier of overlap margins than set them, especially non rectangular ones. This uses the overlay option of tikzpicture (run twice). \documentclass[8pt, letter, twocolumn]{extarticle} \usepackage[...
John Kormylo's user avatar
  • 79.3k
4 votes
Accepted

How to put a line and a note under a certain column in tables?

Part of the issue with your code is that it specifies the table to have seven columns, while it has only six. This causes a noticeable "overhang" of the horizontal lines. Fixing this issue, ...
Mico's user avatar
  • 503k
3 votes

Set column width with word wrapping and centered text

The following solution doesn't employ any \multirow directives. It further aligns the numbers in the data columns on their explicit or implicit decimal markers. Finally, it gives the table a more open ...
Mico's user avatar
  • 503k
3 votes
Accepted

Set column width with word wrapping and centered text

Not sure why * isn't working, but adding the width does (my manual doen't list = as an option). The other problem is that 3cm isn't wide enough for the column, but is already too wide to fit the ...
John Kormylo's user avatar
  • 79.3k
1 vote
Accepted

biblatex: Customise formatting of back-references

You can modify the bibmacro pageref. The original definition can be found in biblatex.def (ll. 2949-2956 in v3.19). Setting bibstrings to empty strings will usually not result in satisfactory output, ...
moewe's user avatar
  • 175k
3 votes

Is it possible to define atomic chunks of math which automatically do line breaks when necessary?

autobreak can be used for this specific example if you insert \MoveEqLeft[0] as the first "chunk" (note that in the autobreak environment chunk boundaries are represented as line breaks): \...
tueda's user avatar
  • 168
3 votes
Accepted

How to create Approval Sheet

This is a working example. However, I don't know your document class. It should be working anyway. \documentclass{report} \usepackage{xcolor} \begin{document} \thispagestyle{empty} \addcontentsline{...
Tom's user avatar
  • 6,803
1 vote
Accepted

Pgf plot with two y-axes but same x-axis: how can I only show y-values for specific x-values in the second axis?

There is a lot of unrelated code in your MWE, so I will not edit and repost it. You can use a dummy plot \addplot[] plot coordinates {(A,0) (E,0)}; as suggested by @Jasper Habicht or better: \addplot[...
hpekristiansen's user avatar
4 votes
Accepted

TikZ tree alignment with multiline node labels

Something to point you in the right direction -- as adapted from -- Control tikz tree \documentclass[border=10pt]{standalone} \usepackage{tikz} \tikzset{ treenode/.style = {shape=rectangle, ...
js bibra's user avatar
  • 21k
1 vote

How do I change the section numbers in an article class document?

I suggest you switch from the report to the article document class; this may be what you want to do anyway, given the title of your posting. Alternatively, I suggest you run the instruction \...
Mico's user avatar
  • 503k

Top 50 recent answers are included