# Apply \intextsep at top of page

In trying to provide an answer to this question: Two column trouble - positioning of figures and text, I realized that I need to shift the wrapfigure up to account for the extra spacing that the \colorbox was adding. I adjusted the \intextsep length, which works fine, except at the top of a page. Note that the black box is not lined up with the top of the horizontal line, but the blue one is.

I found many hackish solutions which "fix" this problem (but add a small amount of blank space at the top of the page), including: \smash{}, \llap{}, \rlap{}, \hphantom{}, \vphantom{}, \ which all get TeX to know that we are not at the top of a page so that \intextsep gets applied.

Questions:

1. What is the proper way to fix this spacing?
2. How would I go about adding a zero height, zero width box at the top so that no space is added and that \intextsep gets applied, but makes TeX behave as if it is not at the top of page? Of course, an alternate solution to #1 may not require this, but am still interested in knowing.

Here is the code:



Replay

try it this way:

\newcommand*\WarningHead[1]{%
\colorbox{black}{\parbox{\linewidth}{\color{white}\textbf{#1}}}\vspace{10px}%
}

\newcommand*\WrapFigure[1]{\leavevmode%
\setlength\intextsep{-3pt}%
\begin{wrapfigure}{r}[0pt]{0.3\linewidth}%
\raggedleft% right align the figures
\includegraphics[width=0.95\linewidth]{#1}%
\end{wrapfigure}
}%



to prevent the additional vertical space you can do

\newcommand*\WrapFigure[1]{%
\ifhmode\else\leavevmode\vspace*{-\normalbaselineskip}\fi%
\setlength\intextsep{-3pt}%



Just insert an instruction such as \phantom{a} right after \begin{document}. I wouldn't call it "hackish" at all. :-)

Category: spacing Time: 2011-11-08 Views: 1

## Related post

• top-of-page positioning: \longtable vs. \tabular 2012-09-18

Why is a longtable environment on top of pages vertically placed different to a tabular environment? I'm digging several days on this question and didn't find a way to align the longtable vertically in the same way. Code: \documentclass[11pt,a4paper]

• Modifications to the Suite Bar are only applied to the top level site in the Site Collection 2013-07-05

I have used PowerShell to change the left part of the Suite Bar in Sharepoint 2013. However, the changes are only applied to the top level site of the site collection. I assumed it would change for the entire Web Application since it is a property of

• Firefox or Chrome extension to imitate Apple browser start (top sites) page 2011-05-06

Does anyone know an extension for Windows (for Firefox or Chrome) which changes the browser start page to look like the top sites page on Apple Safari, so that the top sites view will be concaved? --------------Solutions------------- you can try the

• "Automatically add new top-level pages" Default 2011-11-28

I'm looking for a way to set the default "Automatically add new top-level pages" to be checked when creating a new menu. I haven't been able to find anything on this - any help you could give me? Thanks! --------------Solutions------------- <

• Spurious space above align environment at top of page/minipage 2011-12-03

It seems that the align environment adds additional vertical space if it starts at the top of a page or minipage. Below are two pages, and two minipages (on Page 1), where the first page/minipage has text followed by an align* environment, and the se

• How to add "cont." section title to the top of pages? 2012-01-28

I have a document that contains few small sections. What I would like is if the section name was repeated at the top of page body (not in the header), if new section doesn't start on that page. And the repeated name should include something like "(co

• Do people use jump to top of page links? 2012-04-27

I'm talking about links or buttons at the bottom of the page or screen simply linking to the top of the website. Is there any data on that? Are they used more frequently on long pages? What about mobile? I know that iOS has a built in function for it

• Debugging vertical space on top of page (section inside a custom biblatex cite command)? 2012-07-03

Please consider the following MWE, compiled with lualatex test.tex (+ bibtex test + lualatex test.tex): \documentclass[twoside,a4paper]{book} \usepackage{lua-visual-debug} \usepackage{lipsum} \usepackage{biblatex} \addbibresource{biblatex-examples.bi

• LaTeX - How do I prevent extra whitespace when an equation falls at top of page 2012-07-26

I am a newbie to LaTeX, so if this question is simple to answer please forgive me. I wish to keep the content in my document flush with the top margin. However, when an equation falls at the top of a page as in the MWE below, the equation environment

• Targeting all pages except top level pages 2012-09-05

I have used '0' == $post->post_parent successfully in my templates to target top level pages. However, I cannot seem to target all pages EXCEPT top level pages: <?php if ( '0' !==$post->post_parent ) { include 'siblings.php'; } ?> Using the c

• IEEEtran - Two tables on top of page, two column 2012-11-04

I can't put my tables on the top of page two column, searched for several other tex.stackexchange questions. None of them did help. My table, two tabulars inside: \begin{table*}[!t] \centering \begin{tabular}{ccc} \hline a&b&c\\ \hline \end{tabula

• Subfigure moves figures on the top of page 2012-12-16

I tried to put two figures in one row and I found that subfigure package could help me. But code: \documentclass[11pt, a4paper, draft]{article} \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} \begin{document} \section{Example } Lor

• Retrieve Structure Top Level Pages 2013-03-25

I find myself struggling with some of Structure's documentation and cannot find an answer via Google either, here's the skinny: Currently have 2 top level "pages" (2 more but are hidden because I dont need them in the nav list). Each of these ha

• Google Analytics: How do I create a custom report to view today's top visited pages by page title? 2013-06-07

I'm trying set a "Custom Report" that shows today's top visited pages by page title. Here's a picture of what I have set so far: I tried to filter by "Date" with "Today" selected, but that does not seem to work. Does anyone k

• Top Level pages in wordpress giving 404, but child pages working fine 2013-06-20

Basically everything works fine except for the top level pages ( e.g. category, archives, single post, custom post type, etc...). I have 3 custom post types and 4 custom taxonomies (each custom taxonomy is attached to a post type respectively and the

• Conditional tag in Widget Logic for checking if top level page or if subpage 2013-07-01

I'm using the Widget Logic plugin to show widgets on certain pages using Wordpress Conditional Tags (or any general PHP code). What I would like to do is only show a widget on child pages, not top level pages. I tried both of the following but they b

• Dynamically Register Sidebars For Each Top Level Page 2013-07-25

I have a small website that wants a different sidebar for each page containing blocks of text, blocks of images, and blocks of links, etc. What I'm trying to do is register a sidebar for each top level page: if ( function_exists('register_sidebar') )

• Show content if page is a grandchild of top level page 2013-08-06

I'm looking to show a certain block of content if the current page is a grandchild of a top level page. This is my current page heirarchy; - Top Level Page - Child Page - Grandchild Page - Grandchild Page - Grandchild Page - Child Page - Grandchild P

• Images / Photos and text boxes jump to top of page 2013-10-27

Images / Photos, text boxes and text boxes with images embedded in them jump to top of page in some cases and not others. "Control + arrow keys" have no effect. It is even difficult to drag None of the usual remedies has any effect... "Wrap