Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using lingmacros' \enumsentence with a \psmatrix inside.

\enumsentence{
\psset{linewidth=.5pt}
\begin{psmatrix}[rowsep=.2cm,nodesep=.05cm,colsep=.1cm]
&\rnode{gm}{grammatical morphemes}\\
\rnode{m}{\textit{bound}}&&\rnode{s}{free}\\
&\rnode{h}{\textit{head}}&&\rnode{d}{dependent}\\
&&\rnode{c}{\textit{complement}}&&\rnode{mod}{\textit{modifier}}
\ncline{gm}{m}\ncline{gm}{s}
\ncline{s}{h}\ncline{s}{d}
\ncline{d}{c}\ncline{d}{mod}
\end{psmatrix}
}

This results in the example number aligned with the bottom of the psmatrix. I'd like it to align with the top. Normally, I think, minipage is used for this sort of thing. However, it seems that minipage isn't helping in this context (I'm flummoxed as to why.)

I found a thread with what seems to be a similar question here. But I don't see an answer given.

Any ideas?

edit: in reply to a comment, I'm adding a minimal working example:

\documentclass{article}
\usepackage{pstricks,pst-node}
\usepackage{lingmacros}
\begin{document}


\enumsentence{
\psset{linewidth=.5pt}
\begin{psmatrix}[rowsep=.2cm,nodesep=.05cm,colsep=.1cm]
&\rnode{gm}{grammatical morphemes}\\
\rnode{m}{\textit{bound}}&&\rnode{s}{free}\\
&\rnode{h}{\textit{head}}&&\rnode{d}{dependent}\\
&&\rnode{c}{\textit{complement}}&&\rnode{mod}{\textit{modifier}}
\ncline{gm}{m}\ncline{gm}{s}
\ncline{s}{h}\ncline{s}{d}
\ncline{d}{c}\ncline{d}{mod}
\end{psmatrix}
}

\end{document}

The above code compiles but produces the example number aligned with the baseline of the psmatrix as described above.

share|improve this question
    
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  egreg Dec 7 '12 at 22:18
add comment

1 Answer

up vote 4 down vote accepted

One might think of using \adjustbox from the adjustbox package, but it turns out that this package is not compatible with pstricks because they both define \clipbox. A workaround is to emulate what the package does in the case we need:

\documentclass{article}
\usepackage{pstricks,pst-node}
\usepackage{lingmacros}
\newcommand{\tstrut}{\vrule width 0pt height\ht\strutbox depth 0pt}
\begin{document}

\enumsentence{\raisebox{\dimexpr-\height+\ht\strutbox}{%
\psset{linewidth=.5pt}
\begin{psmatrix}[rowsep=.2cm,nodesep=.05cm,colsep=.1cm]
&\rnode{gm}{\tstrut grammatical morphemes}\\
\rnode{m}{\textit{bound}}&&\rnode{s}{free}\\
&\rnode{h}{\textit{head}}&&\rnode{d}{dependent}\\
&&\rnode{c}{\textit{complement}}&&\rnode{mod}{\textit{modifier}}
\ncline{gm}{m}\ncline{gm}{s}
\ncline{s}{h}\ncline{s}{d}
\ncline{d}{c}\ncline{d}{mod}
\end{psmatrix}}%
}

\end{document}

The trick is to lower the psmatrix by its height minus the height of the standard strut. However, the first line in the matrix must be made as high as the strut (but not as deep under the baseline or the lines would be clipped), so I define a "top strut".

enter image description here

Alternatively, you can load adjustbox, but with a trick for making it compatible with pstricks; the macro \clipbox of adjustbox (which is not necessary here) becomes \adjclipbox.

\documentclass{article}
\usepackage{pstricks,pst-node}

%%% trick for using adjustbox
\let\pstricksclipbox\clipbox
\let\clipbox\relax

\usepackage{adjustbox}

\let\adjclipbox\clipbox
\let\clipbox\pstricksclipbox
%%% end

\usepackage{lingmacros}

\begin{document}

\enumsentence{\begin{adjustbox}{valign=t}
\psset{linewidth=.5pt}
\begin{psmatrix}[rowsep=.2cm,nodesep=.05cm,colsep=.1cm]
&\rnode{gm}{grammatical morphemes}\\
\rnode{m}{\textit{bound}}&&\rnode{s}{free}\\
&\rnode{h}{\textit{head}}&&\rnode{d}{dependent}\\
&&\rnode{c}{\textit{complement}}&&\rnode{mod}{\textit{modifier}}
\ncline{gm}{m}\ncline{gm}{s}
\ncline{s}{h}\ncline{s}{d}
\ncline{d}{c}\ncline{d}{mod}
\end{psmatrix}
\end{adjustbox}%
}

\end{document}
share|improve this answer
    
Excellent answer. Thanks egreg. I found that your solution using \raisebox and \tstrut almost worked perfectly for me. In my actual document, I'm using Charis SIL font (maybe that's a crucial difference?). Anyway, for me, bottom of the words 'grammatical morphemes' were at the midline of the example number, rather than the bottom. I can add '+1ex' to the end of the height and that gets me close. Perhaps I should try the adjustbox solution you also posted. –  apexofservice Dec 7 '12 at 23:38
    
@apexofservice Please, have a look at the site FAQ (you find the link at the top of the page), particularly tex.stackexchange.com/faq#reputation –  egreg Dec 7 '12 at 23:40
    
okay, I've read that. What was I missing or doing wrong? –  apexofservice Dec 7 '12 at 23:42
    
@apexofservice Nothing wrong. But voting for helpful answers is an important aspect of the StackExchange network; it gives a measure of what answers are better and also helps in searches. For instance, I upvoted your question, because it's interesting and has all that's needed for understanding and analyzing the problem. I'm not pledging for your vote, just trying to explain how the site works. –  egreg Dec 7 '12 at 23:46
    
got it. I would have upvoted your answer but my reputation is in fact too low to have that privilege. I was able to 'accept' though. –  apexofservice Dec 7 '12 at 23:48
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.