Skip to main content
17 votes
Accepted

How to make text appear in the middle of a phantom in math mode?

You don't really need to use \mathclap, you can just place what you want to center in a box of the appropriate width. \documentclass{article} \usepackage{amsmath} \usepackage{calc} \newcommand*{\mask}...
Vincent's user avatar
  • 21.2k
12 votes

How to make text appear in the middle of a phantom in math mode?

A version that works in all styles. \documentclass{article} \usepackage{amsmath} \makeatletter \newcommand{\mask}[2]{{\mathpalette\mask@{{#1}{#2}}}} \newcommand{\mask@}[2]{\mask@@{#1}#2} \newcommand{...
egreg's user avatar
  • 1.3m
9 votes
Accepted

\phantom not giving correct space?

You forgot to put {}< at the beginning of the \phantom. \documentclass{article} \usepackage{amsmath} \begin{document} \begin{alignat*}{2} d\bigl(x^{(j)}_j, x^{(i)}_i\bigr) & \le d\bigl(x^{(...
egreg's user avatar
  • 1.3m
8 votes
Accepted

tikzmarknode and vphantom take up horizontal space

The problem is minimum width which has the value 1pt (the documentation seems to be wrong here). Probably tikzmark should better set it to 0pt in the \tikzmarknode, make a bug report. \documentclass{...
Ulrike Fischer's user avatar
8 votes
Accepted

How to vertically align subscripts in mathmode

The reason why \vphantom does not work is subtle, and has to do with some TeXnical details concerning the way it is implemented. The definition of \vphantom is \def\vphantom{\v@true\h@false\ph@nt} ...
GuM's user avatar
  • 22.2k
8 votes
Accepted

Multilines, multipages \phantom analog macro

In LuaLaTeX, this can be implemented similar to lua-ul and luacolor: Use an attribute to mark all text that should be removed, then hook into the shipout routine to delete/replace with empty space: ...
Marcel Krüger's user avatar
8 votes
Accepted

\phantom and \obeylines

If you use LaTeX the markup you show has the effect you intended. \documentclass{article} \begin{document} \begingroup\obeylines it's magic \hphantom{it's} tragic \endgroup%obeylines \end{document} ...
David Carlisle's user avatar
7 votes

\hphantom with \footnotesize, siunitx and unicode-math

The widths of the digits are not the same in STIX Two Math at \footnotesize. Why? Ask STIX. \documentclass{scrartcl} \usepackage{fontspec} \usepackage{unicode-math} \setmainfont{STIX Two Text} \...
egreg's user avatar
  • 1.3m
7 votes

How to modify the cell dimensions in tikzcd?

Just to let you know how to do this in plain TikZ, even if this is not what you're asking for: \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{positioning, arrows.meta} \begin{...
SebGlav's user avatar
  • 19.7k
7 votes

Weird behaviour when using amssymb, hphantom, bm and widehat

amsfonts \wideaccent is affected by the current contents of box 0 which is unfortunate, this seems to fix it (\bm really should be inside the math although actually it makes no difference here) \...
David Carlisle's user avatar
6 votes
Accepted

How to make a superscript of arbitrary width?

This might do. I allocate the same left-aligned width for each of the superscripts. ORIGINAL Answer: Good if one does not need the script styles. \documentclass{article} \usepackage{mathtools,xspace,...
Steven B. Segletes's user avatar
6 votes

How to obtain overline to a blank character?

\phantom had to have an argument, for example $\overline{\phantom{I}}$ For it you can define \newcommand, for example as is done in the following MWE: \documentclass[border=3.141592]{standalone} \...
Zarko's user avatar
  • 320k
6 votes

How to modify the cell dimensions in tikzcd?

Here is a tikz-cd solution. The idea is to use \fcolorbox to draw the boxes around the text, and \llap and \rlap to control the arrow placement. Box color is controlled globally with \cdboxcolor, set ...
Sandy G's user avatar
  • 52.6k
6 votes
Accepted

Hiding informations

Here is a better way to do it: This is what you get, after copy and paste from the pdf: To censor it . To blackout it, . For more alternatives see topic security at ctan, where only luacensor may be ...
MS-SPO's user avatar
  • 25.9k
5 votes

How to vertically align subscripts in mathmode

A simple \smash does the trick: \documentclass{article} \usepackage{braket} \begin{document} \begin{equation} \rho_{AB}=\smash{\ket{0}}_{AB}\otimes_{AB}\bra{0} \end{equation} \end{...
Bernard's user avatar
  • 278k
5 votes
Accepted

How to make some character "unreadable" as text in the pdf output but still visible?

Just use the accsupp (Accessibility Support) package. \documentclass{article} \usepackage{accsupp} \begin{document} \BeginAccSupp{ActualText=hose}% horse% \EndAccSupp{}% \end{document} $ pdftotext ...
Henri Menke's user avatar
5 votes
Accepted

How to align these two expressions, one has one more number?

You have to remove the 1 from the \phantom, since it shows up explicitly outside the \phantom. I replace it with {} placeholder. \documentclass{article} \begin{document} \[\begin{array}{c} (-(...
Steven B. Segletes's user avatar
5 votes

Align equalities using stackrel

I'd create a bit of vertical distance between "Satz 4.3" and the "=" symbol, by inserting an arrow symbol, and I'd then "squash" the width of the text/arrow combination to zero via a \mathclap ...
Mico's user avatar
  • 558k
5 votes

\hphantom with \footnotesize, siunitx and unicode-math

Changing it to use 0.6 in all cases \Si uses text mode ......\hbox(5.814+0.108)x11.475, direction TLT .......\TU/STIXTwoText(1)/m/n/9 0 .......\TU/STIXTwoMath(1)/m/n/9 . .......\TU/STIXTwoText(1)/m/n/...
David Carlisle's user avatar
5 votes

How to modify the cell dimensions in tikzcd?

I'm not quite sure what you mean by Note: I deliberately write "at a specific place", and not just the special cases of left and right alignments. What other kind of alignments are there? ...
Qrrbrbirlbel's user avatar
5 votes
Accepted

Align two rows only using \phantom command

Not the best approach. Add alignment points and let TeX do the spacing. In the second realization I compressed the spaces and made a few cosmetic changes. \documentclass{article} \usepackage{amsmath,...
egreg's user avatar
  • 1.3m
5 votes

Phantom overline over visible expression

There are two options you can take: \smash will cause its argument to act like it’s under an \overline (or inside a \sqrt): \[ f(\smash{x'},\overline{x'}) \] You can define a command that will set ...
Don Hosek's user avatar
  • 15.2k
4 votes
Accepted

Incomplete \iffalse in \caption, but correct in regular text. Where's the \if?

The problem is that your definition of \disjointcompl makes it a fragile command, that has to be prefixed by \protect if used in a moving argument (caption or section title). You can use \...
egreg's user avatar
  • 1.3m
4 votes
Accepted

Alignment of terms within align environment

I would use a top-aligned aligned environment (pun intended) inside the align* environment. Separately, I would also try to de-clutter the appearance of the equations by using fewer pairs of ...
Mico's user avatar
  • 558k
4 votes

Alignment of terms within align environment

I added {} so you get relation spacing \documentclass{extarticle} \usepackage{amsmath,bbm,bm,amssymb,amsthm,mathtools,cleveref,physics,letltxmacro} % For usage in align environments. \newcommand\...
David Carlisle's user avatar
4 votes
Accepted

Align numbers at ","

Use siunitx's S column type to align commas. \documentclass{article} \usepackage{multirow} \usepackage{siunitx} \sisetup{output-decimal-marker = {,}} \usepackage{booktabs} \begin{document} \begin{...
fractal's user avatar
  • 1,520
4 votes

How to set \phantom{-} automatically for entries of matrices?

The amsmath environments [pbBvV]?matrix use a common \env@matrix macro to start the alignment. In this macro there is \array{*\c@MaxMatrixCols c}, which centers the contents of the cells by default. ...
Phelype Oleinik's user avatar
4 votes
Accepted

How to make multiple variables take the same width in math mode?

You could use eqparbox. In the first example, the objects are centered in the allotted space, in the second one the alignment is right and left. The tags are arbitrary, you need to use different ones ...
egreg's user avatar
  • 1.3m

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