So I have the following LaTex list, and many like it in a paper I'm translating:
\begin{enumerate}
\item If $\mathfrak{E}$ and $\mathfrak{B}$ with the arguments $x, y, z$ a solution of the Maxwell's equations (1), then through the components $\mathfrak{E}_x, \mathfrak{E}_y, \mathfrak{-E}_z, \mathfrak{-B}_x, \mathfrak{-B}_y, \mathfrak{B}_z$, with the arguments $x, y, z$ is given also an electromagnetic field that is a solution to Maxwell's equations.
\item If $\mathfrak{E, B}$ is the electromagnetic field of a planar electromagnetic wave radiation, then $\mathfrak{E}_x, \mathfrak{E}_y, \mathfrak{B}_z$ are symmetrical to the plane of the figure with $\mathfrak{E}_z, \mathfrak{B}_x, \mathfrak{B}_y$, with opposite values.
\item If $\mathfrak{E, B}$ a solution to Maxwell's equations (1), the following field is as well:
$$\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} = \mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}$$
\end{enumerate}\par
It compiles to this:
There's a lot of dead space that should be taken up by text. How do I make the text wrap around the numbers?
PS. Also, I'm trying to add space between the equations. Simply putting more spaces didn't do it. Any pointers?
Strange how you want to save space in the enumeration yet add space between equations. I enjoy the current display. However, you can use a custom mylist which looks like an enumerate without alignment:
\documentclass{article}
\usepackage{showframe}% Just for this example
\usepackage{amsfonts}
\newenvironment{mylist}
{\setlength{\parindent}{0pt}% No paragraph indent
\setcounter{enumi}{0}% Restart enumeration at level 1 (i)
\renewcommand{\item}{\par\refstepcounter{enumi}%
\theenumi.~\ignorespaces}%
}{}
\begin{document}
\begin{enumerate}
\item
If~$\mathfrak{E}$ and~$\mathfrak{B}$ with the arguments~$x$, $y$,~$z$ a solution of the Maxwell's equations~(1),
then through the components~$\mathfrak{E}_x$, $\mathfrak{E}_y$, $\mathfrak{-E}_z$, $\mathfrak{-B}_x$,
$\mathfrak{-B}_y$,~$\mathfrak{B}_z$, with the arguments~$x$, $y$,~$z$ is given also an electromagnetic field
that is a solution to Maxwell's equations.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ is the electromagnetic field of a planar electromagnetic wave radiation,
then~$\mathfrak{E}_x$, $\mathfrak{E}_y$,~$\mathfrak{B}_z$ are symmetrical to the plane of the figure
with~$\mathfrak{E}_z$, $\mathfrak{B}_x$,~$\mathfrak{B}_y$, with opposite values.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ a solution to Maxwell's equations~(1), the following field is as well:
\[
\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} =
\mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}
\]
\end{enumerate}
\begin{mylist}
\item
If~$\mathfrak{E}$ and~$\mathfrak{B}$ with the arguments~$x$, $y$,~$z$ a solution of the Maxwell's equations~(1),
then through the components~$\mathfrak{E}_x$, $\mathfrak{E}_y$, $\mathfrak{-E}_z$, $\mathfrak{-B}_x$,
$\mathfrak{-B}_y$,~$\mathfrak{B}_z$, with the arguments~$x$, $y$,~$z$ is given also an electromagnetic field
that is a solution to Maxwell's equations.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ is the electromagnetic field of a planar electromagnetic wave radiation,
then~$\mathfrak{E}_x$, $\mathfrak{E}_y$,~$\mathfrak{B}_z$ are symmetrical to the plane of the figure
with~$\mathfrak{E}_z$, $\mathfrak{B}_x$,~$\mathfrak{B}_y$, with opposite values.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ a solution to Maxwell's equations~(1), the following field is as well:
\[
\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} =
\mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}
\]
\end{mylist}
\end{document}
For changing the spacing around display equations, see How can I decrease spaces between equations? Also see Why is \[ … \] preferable to $$ … $$?
Related
I'm working on a LaTeX beamer presentation where I'd like to add a notes section below each \item heading which simply copies its text. For example I have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\end{itemize}
\end{frame}
and I would like to have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\note<.>[item]{
Einstein was a clever man.
}
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\note<.>[item] {
My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
}
\end{itemize}
\end{frame}
How can I do this in vim, or using command line tools like awk or sed?
Via vim I'm able to copy-and-append isolated lines starting with the pattern \item via
:g/^\\item/ copy . | s//\\note\{item\}<.>\{/g
but I'm unable to capture the whole block belonging to each top-level \item.
This might work for you (GNU sed):
sed -E '/^\\begin\{itemize\}/{:a;n;/^\\end\{itemize\}/bb
/^( {4}|\t)\\item/{
:b;x;s/^(\s*)\\item(.*)/\1\\note<.*>[item]{\n\1\1\2\n\1}/p;x;h;ba}
H;ba}' file
Focus on lines between \begin{itemize} and \end{itemize}
Make a copy of each \item and append the copy to each \item stanza, replacing the \item command by the desired \note command.
N.B. The solution depends on the whitespace indenting the \item command, currently the indent is set at 4 spaces but tabs may be used (see regexp at the beginning of the second line).
I have a XLD edge, like the one in red in the sample picture below.
I need to extract start/endpoint of straight lines that reppresent it. Hough lines sort of work for this, but the results are not really replicable. minor changes in the contour produce unexpected results.
How can the contours be extracted as straight lines? (blue) with start and finish coordinates?
lines shorter than a specified length should not be counted as separate line.
Contour needs to be converted to a polygon using the following function:
gen_polygons_xld (Object, Polygons, 'ramer', 25.0)
The only adjustable parameter is the alpha (25.0) which decides the approximation threshold.
So I was reading a Document about Displacement Mappings and Surface Blendings and came across this equation which is supposed to be a Alpha-Blending equation:
while v1,...,vn are supposed to be the value vector and w1,....,wn the weight vector (is how the document describes it).
To tell what my interpretation of this equation is, is that considering n being the number of surfaces we are trying to blend together the value vectors are supposed to represent as the name says the value (probably color related?) of each surface and the weight vector basically describing the value preference of each surface (so the higher the weight value the more we would see the color of that one surface after the blend). The multiplication and division part is something what i do not fully understand (just interpreting it as the 'it just works like that' part of the equation)
I couldn't find any similar equation anywhere so far so I figured out that either I didn't search deep enough or I am not understanding something that is supposed to be very obvious and I wanted to make sure that fully understand this equation for further read in the document which bases on this idea.
I have images that have had features extracted with a contouring algorithm (I'm doing astrophysical source extraction). This approach yields a "feature map" that has each pixel "labeled" with an integer (usually ~1000 unique features per map).
I would like to show each individual feature as its own contour.
One way I could accomplish this is:
for ii in range(labelmask.max()):
contour(labelmask,levels=[ii-0.5])
However, this is very slow, particularly for large images. Is there a better (faster) way?
P.S.
A little testing showed that skimage's find-contours is no faster.
As per #tcaswell's comment, I need to explain why contour(labels, levels=np.unique(levels)+0.5)) or something similar doesn't work:
1. Matplotlib spaces each subsequent contour "inward" by a linewidth to avoid overlapping contour lines. This is not the behavior desired for a labelmask.
2. The lowest-level contours encompass the highest-level contours
3. As a result of the above, the highest-level contours will be surrounded by a miniature version of whatever colormap you're using and will have extra-thick contours compared to the lowest-level contours.
Sorry for answering my own... impatience (and good luck) got the better of me.
The key is to use matplotlib's low-level C routines:
I = imshow(data)
E = I.get_extent()
x,y = np.meshgrid(np.linspace(E[0],E[1],labels.shape[1]), np.linspace(E[2],E[3],labels.shape[0]))
for ii in np.unique(labels):
if ii == 0: continue
tracer = matplotlib._cntr.Cntr(x,y,labels*(labels==ii))
T = tracer.trace(0.5)
contour_xcoords,contour_ycoords = T[0].T
# to plot them:
plot(contour_xcoords, contour_ycoords)
Note that labels*(labels==ii) will put each label's contour at a slightly different location; change it to just labels==ii if you want overlapping contours between adjacent labels.
I'm trying to find a way to calculate the intersection between a b-spline and a straight line. So far Google hasn't been much help.
A pure mathematical approach:
Transform the spline and the line so that the line lies on the X axis.
Calculate the points on the spline where Y = 0 (depends on the order of the spline).
Transform these points back to your original cordinate system.
If this is the way you are going I can work out the necessary formulas.
The most efficient algorithm that I've heard of is called Bezier clipping.
Here's a book chapter on curve and spline intersection (pdf).
Your best approach might be to break down your spline into individual line segments and test each line segment for intersection with the line. The spline may intersect the line in more than one point, so you'll also have to decide which one you're interested in.