Easy to follow LaTeX tutorial on layout? - layout

I want to layout a page using LaTeX and distribute text snippets/blocks in predefined locations.
Something like this
+--------------------------------------------------------+
| +-------------+ |
| |bla bla bla| |
| |bla bl ab lab| +-------------+ |
| |bla bla bla| |bla bla bla| |
| |bla bl ab lab| |bla bl ab lab| |
| +-------------+ |bla bla bla| |
| |bla bl ab lab| |
| +-------------+ +----+ |
| |more| |
| Ich und Du |text| |
| Müllers Kuh +----+ |
| |
+--------------------------------------------------------+
My guess is that I should go about this using a minipage or using boxes like
\begin{minipage}[b][2cm]{8cm}
\mbox{more} \newline
\mbox{text} \newline
\end{minipage}
Is there a tutorial or a 'how to' page that you know, that shows me how to do this - not a list all LaTeX idioms, I have some books for that. But my books are more focused on command lists, scientific publishing and math ..

If you want rather "fixed" layouts, then I'd probably look at Tikz and use the absolute positioning it offers. The Tikz manual covers this in some detail (search for "Referencing the Current Page Node – Absolute Positioning" after doing texdoc pgf). A simple example:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\node [xshift=1cm,yshift=1cm] at (current page.south west)
[text width=7cm,fill=red!20,rounded corners,above right]
{
This is an absolutely positioned text in the
lower left corner. No shipout-hackery is used.
};
\end{tikzpicture}
\begin{tikzpicture}[remember picture,overlay]
\node [xshift=10cm,yshift=5cm] at (current page.south west)
[text width=7cm,fill=green!20,rounded corners,above right]
{
A second box placed absolutely.
};
\end{tikzpicture}
\end{document}

Related

Beyond acceptable range of Nested IF & formula not working

Values to check with
| | Northing | Easting |
|-------|----------|---------|
| Inst1 | 41345 | 33467.8 |
| inst2 | 41600.5 | 33607.2 |
| Inst3 | 41900.8 | 33740.2 |
| Inst4 | 41933.4 | 33780 |
| Inst5 | 41829.5 | 33694.6 |
| Inst6 | 41449.9 | 33539 |
Range of Coordinate
| | Northing | | Easting | |
|----|----------|----------|---------|----------|
| T1 | 41158.68 | 41396.88 | 33357.6 | 33517.57 |
| T2 | 41307.9 | 41456.6 | 33384.2 | 33580.5 |
| T3 | 41372.1 | 41517.5 | 33411.3 | 33607.5 |
| T4 | 41431.6 | 41572.7 | 33435.8 | 33632.5 |
| T5 | 41482.9 | 41654.6 | 33472.3 | 33654.2 |
| S1 | 41564.9 | 41701.2 | 33493.1 | 33688.7 |
| S2 | 41611.5 | 41762.3 | 33520.2 | 33708.3 |
| S3 | 41672.7 | 41841.6 | 33555.5 | 33734.1 |
| S4 | 41752.2 | 41897.9 | 33580.6 | 33767.6 |
| S5 | 41809.3 | 41941.7 | 33600.1 | 33791.7 |
| S6 | 41854.6 | 41998.7 | 33625.4 | 33810.7 |
| T6 | 41914.8 | 42055.4 | 33650.7 | 33836.1 |
| T7 | 41971.5 | 42137.4 | 33687.2 | 33859.9 |
Nested IF is not displaying the right value and can't go beyond row 48.
How can I have range M41:Q53 included?
Current formula in place below
=IF(N41<=$H$41<=O41 & P41<=$I$41<=Q41,M41,IF(N42<=$H$41<=O42 &
P42<=$I$41<=Q42,M42,IF(N43<=$H$41<=O43 &
P43<=$I$41<=Q43,M43,IF(N44<=$H$41<=O44 &
P44<=$I$41<=Q44,M44,IF(N45<=$H$41<=O45 &
P45<=$I$41<=Q45,M45,IF(N46<=$H$41<=O46 &
P46<=$I$41<=Q46,M46,IF(N47<=$H$41<=O47 &
P47<=$I$41<=Q47,M47,IF(N48<=$H$41<=O48 & P48<=$I$41<=Q48,M48,"Not
here"))))))))
When comparing coordinates, the choice of coordinate system doesn't change the logic very much. :-)
It can be tricky (but not impossible) to consistently check if a point is within a polygon, but just a plain ol' rectangle like this is straightforward. If you intend to compare more than a few coordinates then nested If's just won't work. (In fact they should be avoided at all times!)
For my quick-n-dirty example I took your data and put it into Columns vs Rows instead of side by side.
The formula is H6 is:
=IF(AND(H$3>=MIN($C6:$D6),H$3<=MAX($C6:$D6),H$4>=MIN($E6:$F6),H$4<=MAX($E6:$F6)),"Match","-")
Basically it's just checking:
Is Northing To Match greater than or equal to `MIN of NorthingStart & NorthingEnd?
Is Northing To Match less than or equal to `MAX of NorthingStart & NorthingEnd?
If Yes to both then the point Northing to Match is within the specified rectangle.
There are a number of other ways this could also be tackled. Which one is the right one depends mainly on how much data you'll be comparing, and whether it's an ongoing need (needing to account for unforeseen circumstances or not)...
The same thing could also be accomplished with side-by-side datasets with the help of an array formula.
Further Reading:
Introduction to Coordinate Geometry (many handy links)
SE: Analytic Geometry: How to check if a point is inside a rectangle?
Wikipedia: Intersection_theory
How to check if two given line segments intersect?
And a but of a tangent (no pun intended), but since I mentioned it & just for fun, a short explanation of:
How to check if a given point lies inside or outside a polygon?
1. Draw a horizontal line to the right of each point and extend it to infinity
2. Count the number of times the line intersects with polygon edges.
3. A point is inside the polygon if either count of intersections is odd or
point lies on an edge of polygon. If none of the conditions is true, then
point lies outside.
How to handle point g in the above figure?
Note that we should returns true if the point lies on the line or same
as one of the vertices of the given polygon. To handle this, after
checking if the line from p to extreme intersects, we check whether
p is colinear with vertices of current line of polygon. If it is
colinear, then we check if the point p lies on current side of
polygon, if it lies, we return true, else false. (Source)

Vim: do not move window content when opening preview / quickfix

When splitting Vim window horizontally, contents of the "old" window are scrolled so as to preserve relative cursor line position. This happens even for small "helper" buffers, like quickfix or preview window.
The text movement caused by this becomes annoying when a split is repeatedly opened and closed - e.g. preview window used by completion plugin. Is it possible to disable this feature, and don't scroll old window when splitting (unless it's necessary to keep cursor line visible)?
Example - current behavior:
+--------------+ +--------------+
| a | | b |
| b | copen | c (cursor) |
| c (cursor) | --> | d |
| d | +--------------+
| e | | (preview) |
+--------------+ +--------------+
Desired behavior:
+--------------+ +--------------+
| a | | a |
| b | copen | b |
| c (cursor) | --> | c (cursor) |
| d | +--------------+
| e | | (preview) |
+--------------+ +--------------+
I reached this question when searching for a solution to this problem myself. I couldn't find a good solution and it really bugged me so I ended up writing a small vim plugin that will solve this.
https://github.com/gillyb/stable-windows
I think it does exactly what you want it to do. I only wrote it recently, so if there's any bugs feel free to open an issue and I will try to fix them.
Hope it helps! :)
Try something like
map <F12> mcHmh:split<cr>'hzt`c
store position in c mc
H move to top
store the position to h mh
your command here split for example
got to h 'h
put this to lien to top zt and got to c

Splitting workspaces in the notion window manager

I have been using the Notion Window Manager (http://notion.sourceforge.net/) for a few weeks. I was wondering if it is possible to create a keybinding that splits a workspace in the same way that META+S and META+K S splits a frame horizontally and vertically.
So if I had two vertical frames in a workspace like this:
-----
|1|2|
| | |
| | |
| | |
-----
The keybinding to split horizontally should add a new frame that spans the workspace horizontally:
-----
|1|2|
| | |
-----
| 3 |
-----
Currently META+S only splits the selected frame horizontally:
-----
|1|2|
| | |
|-| |
|3| |
-----
Is there any way to accomplish splitting the entire workspace horizontally or vertically in Notion?
The solution I came up with is to add a keybinding to the split_top function in cfg_tiling.lua. To split horizontally I added:
kpress(META.."Z", "WTiling.split_top(_, 'bottom')")
to the WTiling defbindings function. I also added
kpress("Z", "Wtiling.split_top(_, 'left')")
to the submap META.."K" bindings.
The split_top function splits at the root of the split tree. This will create a new frame that splits the entire workspace rather than the current frame.
One sizing issue that I noticed with this approach is that it will try to split the workspace exactly in half. If there is a horizontal frame splitting a workspace split_top will resize it to the smallest size and add a new frame below it. If there is a vertical frame it will become about 10 pixels wide when the new frame is added.
Horizontal size issue. New frames are 0 height:
Start ->Mod1+Z ->Mod1+Z
-1--2-- -1--2-- -1--2--
| | | | | | | | |
| | | | | | | | |
-3----- -3----- -3-----
| | -4----- -4-----
| | | | -5-----
| | | | | |
| | | | | |
------- ------- -------
Vertical size issue. New frames are 0 width:
Start -> Mod1+K Z -> Mod1+K Z
-1----2---- -4--1-2---- -5-41-2----
| | | | || | | ||| |
| | | | || | | ||| |
| |3---| | ||3---| | |||3---|
| | | | || | | ||| |
| | | | || | | ||| |
----------- ----------- -----------
Another issue is the focus does not change to the newly create frame. Hitting Mod1+Z will create the frame but the user has to Mod1+TAB to the frame to manipulate it.
This is a start but a comprehensive solution would check for frames that already split the workspace and split them instead and change the focus to the new frame.
Yes, you can.
You either need to put your binding in the workspace context or from the frame/mplex context you need to look up the managing workspace and then call split on that.
(I'd post code and more concrete terms but I'm not in front of a notion machine at the moment and don't want to confuse things by using the wrong ones.)

How to move vertical split window to horizontal split, when there is an existing horizontal split?

In Vim I tend to open buffers in new vertical splits (with the occasional horizontal split). I keep my code to 80 chars wide, so this works pretty well on large monitors.
I often end up with this window arrangement:
---------------------
| | | | |
| | | | |
------ | A | B |
| | | | |
| | | | |
---------------------
At four or five columns wide, it can start getting a bit too narrow, so then I want to move the windows around so it looks like this:
----------------
| | | A |
| | | |
------ ------
| | | B |
| | | |
----------------
As far as I know, this is impossible to do by moving the windows in Vim.
The only way to get that window arrangement I've found, is to close window A, and then re-open A as a new horizontal split from window B.
Is that correct, or is there a way to move/re-arrange windows like that in Vim? Maybe a plugin?
I'm yet to find anything, so I thought I would ask because I find the opening/closing of windows anoying and breaks my flow.
FWIW, I find the Ctrl-W + J / Ctrl-W + K shortcuts useless, because they make the new horizontal split as wide as the whole screen, rather than splitting with the neighbouring window. I.e. Ctrl-W + J would give me this:
----------------
| | | |
| | | |
------ | A |
| | | |
| | | |
----------------
| |
| B |
----------------
Which is generally never what I want.
If anyone has some ideas, let me know!
There's a plugin that can do exactly what you want. Here's the link : https://github.com/fabi1cazenave/suckless.vim.

SVG positioning like position:absolute

I am trying to position an inner element inside the root element. The root element is set to be 100% high and 100% wide. However, I want the inner svg to be 10px or so from the edge of the outer svg--all except the right edge, which I would like to be 200px from the outer right edge. I want this to display in a web browser and so the user should be able to resize the browser and hence the outer svg while the inner svg should be able to maintain the correct distance from the outer svg on each side.
Like this:
+OUTER SVG------------------------------------------+
| |
| +INNER SVG----------------+ |
| | | |
| | | 200px |
| | | <---+-----+----> |
| | | |
| | | | 1
| | | | 0
| | | | 0
| | | | %
| | | |
| | | | h
| | | | i
| +-------------------------+ | g
| | h
| |
+---------------------------------------------------+
100% Wide
Is it possible to do this with SVG alone?
If I understand you correctly, this is trivial. SVG is built to have many visual elements in a Z stack, aligned, overlapped, whatever.
Use Inkscape, free and opensource, to create SVGs, and then you can edit the file directly in a text editor if you want to see how SVG is formed. In Inkscape you can use the alignment tools, the grid, the transform-scaling tool, drag and drop, and probably some other tools to accomplish this.

Resources