开发者

Is there unresizable space in latex? Pictures in good looking grid

I've created latex macro to typeset guitar chords diagrams(using picture environment). Now I want to make diagrams of different appear in good looking grid when typeset one next to each other as the picture shows:

The picture. (on the picture: Labeled "First" bad layout of diagrams, labeled "Second" correct layout when equal number of diagrams in line)

I'm using \hspace to make some skips between diagrams, otherwise they would be too near to each other. As you can see in second case when latex arrange pictures in so that there is same number of them in each line it works. However if there is less pictures in the last line they become "shifted" to the right. I don't want this.

I guess is because latex makes the space between diagrams in first line a little longer for the line to exactly fit the page width. How do I tell latex not to resize spaces created by \hspace ? Or is there any other way ?

I guess I cannot use tables because I don't know how many diagrams will fit in one line...

This is current state of code:

\newcommand{\spaceForChord}{1.7cm}

\newcommnad{\chordChart}[1]{%
  %calculate dimensions xdim and ydim according to settings
  \begin{picture}(xdim, ydim){%
    %draw the diagram inside defined 开发者_运维技巧area
  }%
  \hspace*{\spaceForChord}%
  \hspace*{-\xdim}%
}%

%end preambule and begin document
\begin{document}
First:\\*
\\*
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
\chordChart{...some arguments to change diagram look...}
%...above line is repeated 12 more times to produce result shown at the picture
\end{document}

Thanks for any help.


A long shot, since I can't easily recreate your situation: would wrapping a flushleft environment around your \chordCart be of any help?

I.e.,

First:\\*
\begin{flushleft}
\chordChart{...some arguments to change diagram look...}
...
\end{flushleft}

Second:\\*

If your hypothesis is correct and LaTeX is indeed trying to stretch spaces to justify lines, then the above should solve your problem by turning off justification on the right.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜