Remove unnecessary space for math expressions in Diagram.net - diagrams.net

I use diagrams.net and want to include a math expression in my diagram;
But it takes up unnecessary spacing which messes up the diagram when I export it.
Is there away to avoid/remove this extra spacing?

Related

How to make all numbers and letter take up the same amount of space in latex?

I'm trying to show step by step how to sort an array. But since the numbers and letters take up different amounts of space, the columns get staggered. I'm very new to latex and am not sure if there's an easy fix for this.
If that's not possible, is there some kind of grid system I can use to keep them in straight lines? (without showing the grid).
You can place each of the elements in a box that are of similar width and height. This will ensure that each take up the same amount of space. It's possible using eqparbox's \eqmakebox[<tag>][<align>]{<stuff>}. All \eqmakeboxes with the same <tag> are put in a box of maximum width of <stuff>. You can adjust the <align>ment of every element, if needed (centred, left-aligned or right-aligned).
\documentclass{amsart}
\usepackage{eqparbox}
\newcommand{\swl}[2][nmbr]{\eqmakebox[#1]{\strut #2}}
\begin{document}
\begin{tabular}{c}
\swl{a}\swl{b}\swl{m}\swl{0} \\
\swl{i}\swl{i}\swl{1}\swl{n}
\end{tabular}
\end{document}
The above code provides a wrapper \swl[<tag>]{<stuff>} that provides a similar-width letter macro. If you want a blank space, you can use \swl{~}.
eqparbox uses TeX's \label-\ref system to store the widths and therefore requires at least two compilations for any change (increase in width) in elements under the same <tag>.

Vertical placement of math symbol in LaTeX

I'm using the symbol \otimes as a unary operator and it's vertical alignment doesn't seem right to me. It wants to sit a bit below the baseline. For example, if I define \newcommand{\myop}{\ensuremath \otimes}, then $\myop I$ becomes
and $F_{\myop I}$ becomes
I tried using \raisebox to fix this, e.g.,
\newcommand{\myop}{\ensuremath \raisebox{1pt}{$\otimes$}}
This fixes $\myop I$:
But \raisebox doesn't seem to be sensitive to subscripts. The operator stays the same size while everything around it shrinks:
The problem, I think, is that \raisebox creates its own LR box, which doesn't inherit the settings in the surrounding math environment. Is there a version of \raisebox that "respects math"?
Try \mathchoice (or \mathpalette):
\newcommand{\myop}{%
\mathchoice{\raisebox{1pt}{$\displaystyle\otimes$}}
{\raisebox{1pt}{$\otimes$}}
{\raisebox{0.5pt}{$\scriptstyle\otimes$}}
{\raisebox{0.2pt}{$\scriptscriptstyle\otimes$}}}
The amsopn documentation says:
... the vertical spacing may not be optimal in script and scriptscript
sizes. Unfortunately TeX provides no easy way to do math mode vertical spacing
that varies with current math style like mu units.
$F_{\raisebox{1pt}{\scriptsize$\otimes$} I}$

Manipulating line spacing in LaTeX

I have a block of text in a quotation. Some of that text will be in a very small font (\scriptsize) and some much bigger (\Large). My problem is that the letters in the big font push right up against the letters in the line above. This effect is unacceptably distracting to the reader. (Trust me; for my use, it is.)
My question, then: how do I insert space to push apart the lines so that the large text does not scrape against the text above it?
You can specify \vspace in postscript points. This will give you very fine-grained control.
or...
you can use the setspace package: \usepackage{setspace} then use the commands:
\singlespacing
\onehalfspacing
\doublespacing
or...
you can use \linespacing{factor}: Use
\linespread{1.3} for "one and a half" line spacing, and
\linespread{1.6} for "double" line spacing.
Normally the lines are not spread, so the default line spread factor is 1.
There are myriad methods, but in paper writing, I often use a \vspace{0.75cm} after the separating newline (I'm metric, so pick a unit you like).

How do I indicate an en-dash while in math mode using LaTeX?

There are four kinds of 'dashes' in LaTeX: hyphen, en-dash(--), em-dash(---) and minus $-$. They are used for, respectively, hyphenation and joining words, indicating a range, punctuation, and a mathematical symbol. My question is: how do I indicate an en-dash (range) in math mode? (as in $S=1 to 2$)? Do I have to drop out of math mode in the middle of the 'equation' ($S=1$--$2$)? Or is there a symbol I can use and stay in math mode? I tried $S=1\--2$ but this gives me a minus, not a en-dash, and $S=1--2$ gives two minuses. My guess is I am going to have to drop out of math mode but maybe there is a way to do it without that.
The simplest way is to use $S=1\mbox{--}2$. If you already have \usepackage{amsmath} in your document's preamble, however, you're better off using \text: $S=1\text{--}2$ because \text will adjust the size of the font when used in super- and subscripts: $S_{1\text{--}2}=0$.
An en dash used in math may easily be confused with a minus sign. You may want to look at other techniques for indicating a range such as ellipses (\ldots for dots on the baseline [used between commas], or \cdots for centered dots [used between centered operators such as plus signs]) or using the bracket notation. Some examples:
$S = \{1, 2, \ldots, n\}$ indicates an element in the set containing integers between 1 and $n$.
$S = [0, 1]$ indicates a real number between 0 and 1 (inclusive).
You can use \textrm which does not depend on \usepackage{amsmath}.
Some examples:
$S=1\textrm{--}2$
$S_{1\textrm{--}2}=0$ % correctly changes the font size for subscript
$S_{1\textrm{2}2}=0$ % does not change the font size :(
Or maybe use \textnormal instead of \textrm.
See also LaTeX: use \textnormal instead of \textrm (or \textsf) in math.
Well, you could use $1\mbox{--}2$, but I'd look at the list of math symbols in the symbol list. Hmm. I don't find one.
Use the command \leftrightline in the package MnSymbol. I don't know if it's the length needed for your purposes, but hopefully it will do the trick.

How do I prevent LaTeX from padding spaces between paragraphs so that next section begins at top of next page?

I have a two-column paper where space restrictions are very tight.
I just looked at my last version of the manuscript and saw that the upper half contains a figure (as expected), but in the lower half there is a lot of vertical space between paragraphs (enough to squeeze 10 more lines), and that LaTeX probably added it so that in the beginning of the next page a new numbered section will begin at the top of the page.
I know there's a way to adjust this so LaTeX doesn't try so hard, but I'm not sure how. any help? Thanks!
The parameter that controls inter-paragraph spacing is called \parskip(See Paragraph Spacing ). You set it (with "rubber" values) using something like:
\setlength{\parskip}{1cm plus4mm minus3mm}
The defualt value of \parskip is class dependent. The "plus" and "minus" parts tell TeX how much it can adjust the value to improve the layout (that is they make the spacing elastic, thus the "rubber" designation). Reducing (or eliminating) the "plus" part of the rubber might help.
Watch out though, you can cause other layout artifacts if you constrain TeX too much.
Other things to think about:
The widow and club penalties probably apply section headings, and may be affecting TeX's layout choices (see https://stackoverflow.com/questions/512967/how-can-one-keep-a-section-from-being-at-the-end-of-a-page-in-latex for a discussion).
You may also want to consider messing with \baselineskip which controls the allowed spacing between lines of text and can also have rubber values.
This is a common problem, and there are probably some fairly sophisticated treatments already prepared on CTAN.
\vfill before the new section worked perfectly for me.

Resources