0

I am using Inkscape, together with its LaTeX output feature, to create a block diagram for a report. I want to link each block in the diagram to a particular section in the report, using a hyperref.

Suppose I create a simple block, containing the text \hyperref[sect:eg]{Example}, and I export this diagram from Inkscape to files called example.pdf and example.pdf_tex.

Inkscape block with example text

Then, in my LaTeX file, I write:

\documentclass[11pt]{article}
\usepackage{graphicx}

\begin{document}

\section{example \label{sect:eg}}

\begin{figure}[h]
    \centering
    \def\svgwidth{\linewidth}
    \input{example.pdf_tex}
\end{figure}

\end{document}

This works as expected: the text within the block diagram is clickable and links to the section.

However, I am now facing a problem where I want a block to contain two lines.

Inserting a linebreak from the Inkscape text editor does not work, nor does adding a linebreak manually ('\\').

The compiler (pdflatex) complains about the following line in the example.pdf_tex file:

\put(0.44961172,0.29990378){\makebox(0,0)[t]{\lineheight{1.25}\smash{\begin{tabular}[t]{c}\hyperref[sect:eg]{Example\\Two}\end{tabular}}}}%

Are there any clever workarounds for this? I could try messing around with the pdf_tex source code, but ideally a solution from within Inkscape or my main.tex file would be great.

0

Turns out you can use the makecell package.

enter image description here

Result with same MWE as in question:

enter code here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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