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 use LaPrint in Matlab to generate my EPS figures. In the TeX file that accompanies the EPS file with the LaPrint output, I have some PSfrag commands. If we consider, say, the y-axis, I find in some cases that the y-axis label is very close to the tick marks labels. And in some cases, they overlap. Here is PSfrag code for a y-axis label:

\psfrag{s04}[b][b]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}%

where label s04 is to be replaced by "Force F, kN". I find that I can get further separation between the y-axis label and the tick marks label by using

\psfrag{s04}[bc][bl]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\begin{tabular}{c}Force $F$, kN\end{tabular}}%

where the only change was from [b] to [bc] and [b] to [bl].

However at times this is insufficient. I have been looking at the PSfrag manual but couldn't find any good solutions. Any suggestions?

So I'm basically looking to increase the separation between the y-label and the tick marks on the graph axis. This amounts to moving the y-label more to the left.

share|improve this question
    
I don't know if this will help your problem, but you could try using matlabfrag instead of laprint. –  Will Robertson Aug 27 '10 at 8:45
    
Thanks. I have tested matlabfrag before. It is supposed to be more robust than Laprint. But I don't think so. There are lots of things that you can do with Laprint but not with matlabfrag. Anyhow, I have found a solution (see my answer). –  yCalleecharan Aug 27 '10 at 9:39
    
Off topic regarding matlabfrag: if this is the case please report bugs to the author! (Caveat: who is a friend of mine.) –  Will Robertson Aug 27 '10 at 10:58
    
These kinds of things do unfortunately take time. I don't have the time right now to do some extensive testing with matlabfrag but surely I can do this in the future when I'm less busy. –  yCalleecharan Aug 27 '10 at 11:52
    
and what about using fig2tex instead, that export matlab figures in pstricks? Then you control everything within Latex. –  pluton Aug 27 '10 at 12:55
show 1 more comment

4 Answers

I use struts, or phantom objects, which is ugly but which does the trick. Thus, you might include \phantom{a} or something before the text in order to force the text to the right.

share|improve this answer
    
Thanks for your answer. If I apply your technique to the y axis label, then the label moves upwards. What I want is to increase the separation between the label and the tickmarks i.e. make the label move to the left with respect to the y axis. –  yCalleecharan Aug 27 '10 at 6:18
    
Then add phontom characters after the text. –  Daniel Moskovich Aug 27 '10 at 12:35
    
Thanks. I haven't tried this. But adding phantom characters may not be an elegant solution. With the \arraystretch command, I have just 1 parameter to play with (see my extended answer) and I think it's less messy than using phantom characters. But I know that phantom characters are very useful: I have indeed used them before in other LaTeX documents :). –  yCalleecharan Aug 27 '10 at 15:42
add comment
up vote 1 down vote accepted

I have found a solution by modifying the \arraystretch parameter. It works fine.

e.g.

\psfrag{s04}[bc][bl]{\color[rgb]{0,0,0}\setlength{\tabcolsep}{0pt}\renewcommand{\arraystretch}{1.8}\begin{tabular}{c}Write here\end{tabular}}%
share|improve this answer
    
I'm accepting my own answer for now but others are welcome to post other solutions for this problem. Thanks. –  yCalleecharan Aug 30 '10 at 19:19
add comment

Probably the most general solution is to use a zero sized picture environment containing a \put you can then place the LaTeX text at any coordinate offset.

share|improve this answer
add comment

You could wrap the replacement into \raisebox{±voffset}{...} for vertical displacement and prepend \hspace{±hoffset} for horizontal shifting.

share|improve this answer
add 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.