GeneralPhantom; leftskip; other incl. M(not)WE

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Phantom; leftskip; other incl. M(not)WE

Post by Julian_S_Moore »

Three questions... all no doubt intimately related. MWE included

Horizontal placement of text: in one place \phantom works... on the next line it doesn't.

The pattern is supposed to be a criss-cross but whilst line 4 (numbers at the end of each code line) is fine, line 5's visible text is in the middle.

Second question... I thought I had the hang of this \leftskip etc. business, needing a \par for them to take effect, but they don't seem to be working either. As you can see, I've tried two ways of doing it. (I want this text to be narrowed by the current \parindent)

Thirdly, why is there an extra line after the 1st lipsum paragraph when the narrative environment sets \parskip to zero?

Thanks...

Code: Select all

\documentclass{memoir}
\usepackage{lipsum}% just to generate some text

\newenvironment{narrative}%
	{\setlength{\parindent}{12pt} \setlength{\parskip}{0pt}}
	{}

\begin{document}
	\begin{narrative}
	\lipsum[1]
	%	{\leftskip=12pt \rightskip=12pt \flushleft \dots{} blahhhh \dots{} \par}%1
	%	{\leftskip=12pt \rightskip=12pt \centering \dots{} blah blah? \par}%2
	%	{\leftskip=12pt \rightskip=12pt \flushright \dots{} bla ah bla \dots{} \par}%3
	%	{\leftskip=12pt \rightskip=12pt \centering \dots{} blah blah \dots{} \phantom{\dots{} Bla Blahh \dots{} } \phantom{\dots{} bla \dots{} } \par}%4
	%	{\leftskip=12pt \rightskip=12pt \centering \phantom{\dots{} blah blah \dots{}~\dots{} Bla Blahh \dots{}~}\dots{} Bla \dots{} \par}%5
	%	{\leftskip=12pt \rightskip=12pt \flushleft \dots{} b blah \dots{} \par}%6
	%	{\leftskip=12pt \rightskip=12pt \centering \dots{} Bla Blahh \dots{} \par}%7
	%	{\leftskip=12pt \rightskip=12pt \flushright \dots{} Blahhh \dots{} \par}%8
	
	{\leftskip=12pt \rightskip=12pt
		{\flushleft \dots{} blahhhh \dots{} \par}%1
		{\centering \dots{} blah blah? \par}%2
		{\flushright \dots{} bla ah bla \dots{} \par}%3
		{\centering \dots{} blah blah \dots{} \phantom{\dots{} Bla Blahh \dots{} } \phantom{\dots{} bla \dots{} } \par}%4
		{\centering \phantom{\dots{} blah blah \dots{}~\dots{} Bla Blahh \dots{}~}\dots{} Bla \dots{} \par}%5
		{\flushleft \dots{} b blah \dots{} \par}%6
		{\centering \dots{} Bla Blahh \dots{} \par}%7
		{\flushright \dots{} Blahhh \dots{} \par}%8
	}
	\lipsum[1-2]
	\end{narrative}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Re: Phantom; leftskip; other incl. M(not)WE

Post by Julian_S_Moore »

It really seems broken, but I've worked around it

\newlength{\hpad}
\newcommand{\myphantom}[1]{\settowidth{\hpad}{#1}\hspace{\hpad}}

Then instead of \phantom or \hphantom I just used my new command - paragraph spacing is not upset and I can seem to use \leftskip and \rightskip.

However, if anyone has more information on why the original problem occurred (in case it affects other things) do let me know.
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Phantom; leftskip; other incl. M(not)WE

Post by gmedina »

I'm really busy right now, so I couldn't look in detail at your questions. However, to change the shape of a paragrpah, I would suggest you to take a look at the TeX primitive \parshape (in TeX by Topic you can find its description).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Re: Phantom; leftskip; other incl. M(not)WE

Post by Julian_S_Moore »

Thanks... I did look at \parshape but it didn't seem to provide what I wanted - but I'll look again: I've got a few more things that require special shaping.
Julian_S_Moore
Posts: 72
Joined: Sun Nov 16, 2008 1:26 pm

Phantom; leftskip; other incl. M(not)WE

Post by Julian_S_Moore »

Thanks for Enrico Gregorio on comp.text.tex the answer is that \phantom is not broken, but that if \phantom occurs at the beginning of a line then \leavevmode must precede it.
Post Reply