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}...
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{...
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^{(...
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{...
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}
...
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:
...
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}
...
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}
\...
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{...
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)
\...
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,...
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}
\...
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 ...
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 ...
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{...
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 ...
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}
(-(...
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 ...
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/...
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?
...
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,...
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 ...
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 \...
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 ...
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\...
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{...
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. ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
phantom × 72spacing × 12
math-mode × 10
align × 8
vertical-alignment × 7
horizontal-alignment × 6
equations × 4
indentation × 4
matrices × 4
subscripts × 4
tables × 3
captions × 3
alignment × 3
width × 3
white-space × 3
tikz-pgf × 2
beamer × 2
table-of-contents × 2
amsmath × 2
siunitx × 2
paragraphs × 2
arrays × 2
fractions × 2
cases × 2
box × 2