Strange global offset when exporting to TikZ

Asked by David Roberts

When I export to TikZ (using OS X 10.8.5) I get something like the following (exporting as TikZ picture and as standalone LaTeX):

\begin{tikzpicture}[y=0.80pt, x=0.8pt,yscale=-1, inner sep=0pt, outer sep=0pt]
\begin{scope}[shift={(0,-552.36218)}]
%% picture here
\end{scope}
\end{tikzpicture}

and then *almost* everything has y-coords which are very large (and with nontrivial significant figures to the fourth or fifth decimal place as a result). If I simply remove the option shift=... at the beginning of the scope environment, then the picture is (sometimes!) mangled. Is there anything relatively simple I can do to change this behaviour? (I can follow instructions to edit the exports scripts, but I have no idea how to diagnose and edit myself.) I have used an integer-spaced grid and everything is snapped to it, so I would hope I get at worst a lot of 'blah.0000' which I can remove easily in one sweep.

Also, there is a line in the output,

\path[fill=black,line width=0.8pt] (0,0) node[above right] (flowRoot4890) {};

which with the above-mentioned shift option pushes things down to the bottom of page 2 when compiled. Is there any way to ensure this is not put in the exported file? Clearly I can just take this out from each output file, but it would be nice to not have to do this for dozens and dozens of images. Looking at the raw SVG, I can find the object called 'flowRoot', but that's it.

I've tried shifting the image I'm exporting around on the canvas, which changes the final coordinates, but the shift figure stays the same, and the node called flowRootnnnn moves about.

EDIT: searching around the net, I see this is because of some flowRoot element in the SVG, which probably shouldn't be there. However, there is no flowed text in what I am trying to achieve, and the element is probably left over from the original author of the file (I asked for a sample image to get me started with Inkscape and its TikZ exporter). I've taken that element out from the source SVG, so the strange placement on the page is sorted - my issue with the global shift is still present.

EDIT2: just for reference here's a sample of the range of shifted y-coordinates. The global y-shift is -552.36218

  \path[draw=black,line join=miter,line cap=butt,line width=0.800pt] (605.0000,162.3622) -- (685.0000,162.3622);
  \path[fill=black] (599.74139,197.18968) node[above right] (text5523) {};
  \path[fill=black] (625,212.36218) node[above right] (text5527) {$h$};
  \path[fill=black] (370,87.362183) node[above right] (text5531) {$-\tau_{jv}$};
  \path[fill=black] (640,87.36216) node[above right] (text5535) {$\tau_{kw}$};
  \path[fill=black] (425,47.362179) node[above right] (text5551) {$\overline{\jmath v}$};
  \path[fill=black] (445,77.362175) node[above right] (text5555) {$v$};
  \path[fill=black] (410,117.36217) node[above right] (text5563) {$j$};

(apologies for multiple edits - that's it from me)

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
su_v
Solved:
Last query:
Last reply:
Revision history for this message
David Roberts (droberts-65537) said :
#1

The culprit is, I think, the following code in the SVG file

  <g
     transform="translate(0,-552.36218)"
     id="layer1"
     inkscape:groupmode="layer"
     inkscape:label="Layer 1">

I don't know where it came from, but how do I remove it _in Inkscape_, rather than simply deleting it from the SVG manually?

Revision history for this message
Best su_v (suv-lp) said :
#2

> I don't know where it came from,

Such transforms on top-level layer groups originate from changing the page height or orientation, or when resizing the page to selection or drawing.

> but how do I remove it _in Inkscape_, rather than simply
> deleting it from the SVG manually?

Either
- resize the page before working on the drawing content, and only work on layers created after changing the page size
or
- add new layer(s), and move the content of the old layer(s) to the new layer(s). This might cause some of the moved objects to inherit the transform attribute (e.g. groups, clones, inkscape shapes). If you need to get rid of them completely, you will have to ungroup all groups, convert all shapes to paths, possibly unlink clones, and - to make sure that the transforms are written directly into the path data of the individual paths - select all and nudge the selection with the arrow keys (e.g. one tick to the left and one tick back to the right). This will work with default preferences for transformations (Preferences > Transforms > Store transformation: [x] Optimized).

Revision history for this message
David Roberts (droberts-65537) said :
#3

Ah, ok, thanks. That will help a lot. It should save a lot of manual SVG and/or TikZ editing.