Creating a newenvironment that contains nested environments - nested

I have an issue in latex with the equation spacing. The document must be double spaced, but if the equations are double spaced there is too much vertical white space, especially in the matrices and vectors. I found a solution using setspace:
\begin{spacing}{1}
\begin{align}
equation
\end{align}\\[12pt]
\end{spacing}
Where I need to use the \\[12pt] to adjust the spacing, because without it the equation sits right on top of the following text. To simplify matters, I wanted to create a new environment by using:
\newenvironment{myalign}%
{\begin{spacing}{1}\begin{align}}%
{\end{align}\\[12pt]\end{spacing}}
However I keep getting the an error: '\begin{align} ended by \begin{myalign} or similar. I found another post which explains why I get this error, but it is not obvious to me how to solve the problem.
Any help is greatly appreciated.

In this particular instance, replacing \begin{align} and \end{align} with \align and \endalign should work.

Related

After Effects expression: Color change with keyframes

I am pretty new to expressions in AE and I wasn't able to find a solution for my problem so I hope you can help me out with this.
I use this expression to get global colors for my animation:
comp("COLOR CONTROL").layer("Control").effect("Color 1")("Color")
It works perfectly, but I have a few layers where the color needs to gradually change by using keyframes. The problem is that I don't know how to address these keyframes with an expression.
I guess it's something with "key(1)" and "key(2)" but I wasn't able to find any hint how to do this simple expression. Can anybody help me with this?

Add double lines in the middle of another svg line

so I have a drawing program and I need to implement a "broken line", it is an SVG line with two another lines in the middle of this line, these two line needs to cross perpendicularly to the principal line, maybe this picture can help me to explain the problem:
This line can be drawn in any angle that the user choose
I don't really understand svg's so I'm having a lot of trouble implementing this.
Thank you
So I discovered one way to implement that using polylines and calculating the middle of the source and target coordinates, so when it changes I change the middle point too. After that, I created a marker-mid with the double lines.

Displaying binomials and matrices using asciimath with mathjax

I'm trying to display different math problems using asciimath and mathjax. However some things does not seem to be supported in asciimath. For instance I'm trying to display a binomial/matrix and I can't really figure out how to do it. Would I have to use latex or mathml to do this, or is there a way to use asciimath for this?
update: I found a kinda cheeky way to show binomials in asciimath: (""_1^2) This works, but it is kinda hacky.
You can use
([1],[3])
to get a matrix with two rows of one element each surrounded by parentheses. That may be what you want, though it may be too tall for use with in-line expressions.

How to put a figure on the top of a page on its own in latex?

One of the figures appear in the middle of a page (on its own) when the figure does not fit the other text. How to show it on top of the new page?
If all else fails, just add \vspace*{3in} to the bottom of your figure below the \caption. Then by trial and error change the 3in dimension until you get the look you want. This is of course pure brute force, but sometimes that's a lot easier than trying to get LaTeX to do things the "right" way.
When in doubt, use brute force.
--- Ken Thompson
I think I misunderstood your question. Are you asking "how do I get floats on pages by themselves to be at the top of the page, rather than vertically centred?"?.
If so, here's how to customise the float page. From source2e, glue is inserted at the top and bottom of the page, and between each float on the page. This inserted glue is given by the following parameters:
\setlength\#fptop{0\p# \#plus 1fil}
\setlength\#fpsep{8\p# \#plus 2fil}
\setlength\#fpbot{0\p# \#plus 1fil}
Simply redefine these to get the output you like. For example, for top- and bottom- aligned floats: (untested)
\makeatletter
\setlength\#fptop{0pt}
\setlength\#fpsep{8pt plus 1fil}
\setlength\#fpbot{0pt}
\makeatother
You can insert a pagebreak via \clearpage or \newpage, then use the t option on the figure environment:
...
\clearpage
\begin{figure}[t!]
\centering
\includegraphics[scale=.75]{graphic/...}
\caption{}
\label{fig:}
\end{figure}
...
If there's nowhere for the figure to fit then it will go on a page by itself. See the FAQ answer on floats for more information on how to customise this behaviour.

Alternatives to using text() to adding text to a plot

This may be a naive question, but I was wondering if there's a better way than using text() to adding text to a plot. Note, I'm also using layout() as well. Specifically, I have a section of a plot where I would like to add some text with headings followed by regular text.
text() is fine it seems for simple annotations, but to get the spacing right for several lines of text seems to require a lot of manual manipulation of the x and y and cex parameters. Any suggestions?
Here are some alternative options to consider:
- the gplots package has a textplot function to add some text output in a base graphics plot.
- plotrix has a function addtable2plot
- for grid graphics grid.text() is available and in gridExtra there is a function grid.table() (see, e.g., R-Wiki)
If you're using base graphics, then text() is probably your best bet, and fiddling with coordinates etc is part of the game. If you want to learn a new framework, the lattice package is a reworking of the basic approach to plotting in R. It be installed by default so help(package='lattice') will get you started.
Here's a pretty good guide (pdf) to graphics in general in R, with a substantial section on lattice:
download

Resources