Overleaf 无法正确解释 .svg 图像

Overleaf 无法正确解释 .svg 图像

我正在尝试将这个 .svg 图像添加到我的 tex 文件中,但由于某种原因,Overleaf 无法正确解释它。我尝试添加的图像 - 具有正确文本显示的 SVG 这是 .svg 代码 -

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="662" height="548.328125" style="
        width:662px;
        height:548.328125px;
        background: #FFF;
        fill: none;
">
  <svg xmlns="http://www.w3.org/2000/svg" />
  <svg xmlns="http://www.w3.org/2000/svg" class="role-diagram-draw-area">
    <g class="shapes-region" style="stroke: black; fill: none;">
      <g />
    </g>
    <g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M276.74,242 L162.08,288.25" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.9273798710151121,-0.3741210697568289,0.3741210697568289,0.9273798710151121,160.22754491017963,289)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M392.97,242 L504.58,287.25" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.926725494419827,-0.3757390823328433,0.3757390823328433,-0.926725494419827,506.4333333333334,288)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M279.19,135 L318.18,193.34" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.5557153433806965,-0.8313726343411085,0.8313726343411085,-0.5557153433806965,319.29274611398966,195.00000000000006)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M271.35,49 L270.67,107" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.011693439485246033,-0.999931629399233,0.999931629399233,0.011693439485246033,270.6511627906977,109)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M133.25,315 L156.31,372.15" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.3742829223794759,-0.9273145604459574,0.9273145604459574,-0.3742829223794759,157.06181818181818,374)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M534.83,314 L519,370.08" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.271776393576737,-0.9623604272279812,0.9623604272279812,0.271776393576737,518.4557823129252,372)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
    </g>
    <g>
      <g>
        <rect rx="0" ry="0" x="44" y="23" width="455" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="94" y="109" width="353" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="83" y="195" width="504" height="47" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="49" y="289" width="158" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="466" y="288" width="145" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="31" y="374" width="305" height="131" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="339" y="372" width="316" height="152" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
    </g>
    <g />
  </svg>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="660" height="546.328125" style="width:660px;height:546.328125px;font-family:Asana-Math, Asana;background:#FFF;">
    <g>
      <g>
        <g>
          <text x="48.328125" y="27.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Objective: To determine the enthalpy changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="98.328125" y="113.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Before we do so, we need to learn a few defintions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="87.328125" y="199.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Now that we&#x27;ve learned these definitions, we can start finding the enthalpy </text>
        </g>
      </g>
      <g>
        <g>
          <text x="87.328125" y="220.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="53.328125" y="293.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Experimental methods</text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="470.328125" y="292.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Theoretical methods</text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="35.328125" y="378.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">- Used to determine enthalpy change of </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="399.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">combustion for various liquid (usually </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="420.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">combustible liquid fuels)</text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="35.328125" y="462.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">- Used to determine enthalpy change when </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="483.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">two liquids reacts (usually acids and bases). </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="343.328125" y="376.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">Rely on Hess&#x27;s law. </text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="343.328125" y="418.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">- Enthalpy change of formation for compounds</text>
        </g>
      </g>
      <g>
        <g>
          <text x="343.328125" y="439.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">are used.</text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="343.328125" y="481.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">- Bond enthalpies are also used to calculate </text>
        </g>
      </g>
      <g>
        <g>
          <text x="343.328125" y="502.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;dominant-baseline:text-before-edge;text-decoration:none solid rgb(0, 0, 0);">the enthalpy change accompying a reaction</text>
        </g>
      </g>
    </g>
  </svg>
</svg>

这是我的乳胶代码 -

\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{positioning}
\usepackage{float}
\usepackage[clean]{svg}
\usepackage{graphicx}

\title{Tikz learn}
\author{...}
\date{August 2022}

\begin{document}

\maketitle 
  \begin{figure}
    \centering
    \includesvg{Conceptchart1}
    \caption{Caption}
    \label{fig:my_label}
\end{figure}
\end{document}

下文解释如下: 在此处输入图片描述

我应该怎么办?

答案1

首先是一些技术信息。由于 LaTeX 本身目前无法处理 SVG 文件,因此软件包svg使用 Inkscape 将这些文件导出为 PDF 文件,并可选择使用 LaTeX 渲染文本片段。如果启用了 Inkscape 的此功能,SVG 文件将被拆分为包含所有图形的 PDF 文件和包含所有文本内容的单独文件 *.pdf_tex,然后将其用作图形的覆盖。

不幸的是,在此导出过程中,该属性dominant-baseline被忽略,因此生成的覆盖层垂直位移。也许有些问题应该报告给 Inkscape 团队,我只发现了一个可能相关的问题(https://bugs.launchpad.net/inkscape/+bug/811862)。

跟进:最近这个问题被提及:https://gitlab.com/inkscape/inkscape/-/issues/1170

这给你留下了两个选择:

  1. 使用 LaTeX 删除文本片段的渲染\svgsetup{inscapelatex=false}
  2. 将所有属性更改dominant-baseline:text-before-edgedominant-baseline:auto(或将其全部删除)并垂直重新排列文本框

顺便说一句:仅对包而非包clean有效svg-extractsvg

请参阅后一个选项的示例:

\begin{filecontents}[noheader]{rearranged.svg}
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="662" height="548.328125" style="
        width:662px;
        height:548.328125px;
        background: #FFF;
        fill: none;
">
  <svg xmlns="http://www.w3.org/2000/svg" />
  <svg xmlns="http://www.w3.org/2000/svg" class="role-diagram-draw-area">
    <g class="shapes-region" style="stroke: black; fill: none;">
      <g />
    </g>
    <g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M276.74,242 L162.08,288.25" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.9273798710151121,-0.3741210697568289,0.3741210697568289,0.9273798710151121,160.22754491017963,289)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M392.97,242 L504.58,287.25" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.926725494419827,-0.3757390823328433,0.3757390823328433,-0.926725494419827,506.4333333333334,288)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M279.19,135 L318.18,193.34" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.5557153433806965,-0.8313726343411085,0.8313726343411085,-0.5557153433806965,319.29274611398966,195.00000000000006)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M271.35,49 L270.67,107" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.011693439485246033,-0.999931629399233,0.999931629399233,0.011693439485246033,270.6511627906977,109)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M133.25,315 L156.31,372.15" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(-0.3742829223794759,-0.9273145604459574,0.9273145604459574,-0.3742829223794759,157.06181818181818,374)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
      <g class="connection-group">
        <g class="arrow-line">
          <path class="connection real" stroke-dasharray="" d="  M534.83,314 L519,370.08" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
          <g stroke="#000" transform="matrix(0.271776393576737,-0.9623604272279812,0.9623604272279812,0.271776393576737,518.4557823129252,372)" style="stroke: rgb(0, 0, 0); stroke-width: 1;">
            <path d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29" />
          </g>
        </g>
      </g>
    </g>
    <g>
      <g>
        <rect rx="0" ry="0" x="44" y="23" width="455" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="94" y="109" width="353" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="83" y="195" width="504" height="47" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="49" y="289" width="158" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="466" y="288" width="145" height="26" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="31" y="374" width="305" height="131" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
      <g>
        <rect rx="0" ry="0" x="339" y="372" width="316" height="152" style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;" />
      </g>
    </g>
    <g />
  </svg>
  <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="660" height="546.328125" style="width:660px;height:546.328125px;font-family:Asana-Math, Asana;background:#FFF;">
    <g>
      <g>
        <g>
          <text x="48.328125" y="39.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Objective: To determine the enthalpy changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="98.328125" y="125.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Before we do so, we need to learn a few defintions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="87.328125" y="211.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Now that we&#x27;ve learned these definitions, we can start finding the enthalpy </text>
        </g>
      </g>
      <g>
        <g>
          <text x="87.328125" y="232.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="53.328125" y="305.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Experimental methods</text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="470.328125" y="305.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Theoretical methods</text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="35.328125" y="390.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">- Used to determine enthalpy change of </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="411.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">combustion for various liquid (usually </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="432.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">combustible liquid fuels)</text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="35.328125" y="474.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">- Used to determine enthalpy change when </text>
        </g>
      </g>
      <g>
        <g>
          <text x="35.328125" y="495.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">two liquids reacts (usually acids and bases). </text>
        </g>
      </g>
    </g>
    <g>
      <g>
        <g>
          <text x="343.328125" y="388.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">Rely on Hess&#x27;s law. </text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="343.328125" y="430.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">- Enthalpy change of formation for compounds</text>
        </g>
      </g>
      <g>
        <g>
          <text x="343.328125" y="451.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">are used.</text>
        </g>
      </g>
      <g></g>
      <g>
        <g>
          <text x="343.328125" y="493.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">- Bond enthalpies are also used to calculate </text>
        </g>
      </g>
      <g>
        <g>
          <text x="343.328125" y="514.328125" style="white-space:pre;stroke:none;fill:rgb(0,0,0);fill-opacity:1;font-size:15px;font-family:Arial, Helvetica, sans-serif;font-weight:400;font-style:normal;text-decoration:none solid rgb(0, 0, 0);">the enthalpy change accompying a reaction</text>
        </g>
      </g>
    </g>
  </svg>
</svg>
\end{filecontents}

\documentclass[12pt]{article}
\usepackage{svg}
\svgsetup{inkscapelatex=true}

\begin{document}
\begin{figure}
  \centering
  \includesvg{rearranged}
  \caption{Caption}
  \label{fig:my_label}
\end{figure}
\end{document}

重新排列结果

答案2

因此,正如我在评论中所说的那样“我建议您.pdf从您的作品中制作.svg并使用它。原因:也没有像素化。”

.svg.pdf 转换器

项目的临时链接

结果: 在此处输入图片描述

此外

我将您的.svg代码复制到我电脑上的文件中,结果如下,其中文本也发生了移动。 在此处输入图片描述 (但是当我转换它时,我不知道为什么,但一切看起来都很好)

答案3

有人向我指出了这个问题这里

问题出在 Inkscape 生成的 Latex 代码上。作为解决方法,您可以inkscapelatex局部或全局禁用:(includesvg[inkscapelatex=false]{your.svg}请参阅svg 包文档)。

查看 inkscape 中的 svg: 在此处输入图片描述

左上角的框给出了锚点。您还可以看到文本上方的文本光标。乳胶导出器不是那么智能,它会根据锚点定位文本。正如另一个答案中所说,dominant-baseline这里忽略了。

此外,字体大小可能会略有不同(您实际上可以通过缩放文本(这里为 0.87)来调整它:\includesvg[width=\linewidth,inkscapelatex=true,pretex=\relscale{0.87}]{your.svg}

为了解决所有这些问题,我建议dominant-baseline从 svg 中删除,并以导出器可以理解的方式将文本置于单元格的中心(以解决问题 1170):

  1. 删除dominant-baseline。在这里,使用文本编辑器进行搜索和替换可能是您最好的朋友。
  2. 在 Inkscape 中,使用“文本”工具(按“T”),单击文本区域并在工具栏中选择“居中”。这将更改锚点。
  3. 将文本再次置于框的中心。
  4. 保存 svg。

观察中间的锚点:

在此处输入图片描述

这是编辑后的 ​​svg(是的,它可以更好地对齐):
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="662" height="548.328125" style="
        width:662px;
        height:548.328125px;
        background: #FFF;
        fill: none;
">
  <svg xmlns="http://www.w3.org/2000/svg" />
  <svg xmlns="http://www.w3.org/2000/svg" class="role-diagram-draw-area">
    <g class="shapes-region" style="stroke: black; fill: none;">
      <g />
    </g>
    <g
       id="g68">
      <g
         class="connection-group"
         id="g16">
        <g
           class="arrow-line"
           id="g14">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M276.74,242 L162.08,288.25"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path8" />
          <g
             stroke="#000"
             transform="matrix(0.9273798710151121,-0.3741210697568289,0.3741210697568289,0.9273798710151121,160.22754491017963,289)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g12">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path10" />
          </g>
        </g>
      </g>
      <g
         class="connection-group"
         id="g26">
        <g
           class="arrow-line"
           id="g24">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M392.97,242 L504.58,287.25"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path18" />
          <g
             stroke="#000"
             transform="matrix(-0.926725494419827,-0.3757390823328433,0.3757390823328433,-0.926725494419827,506.4333333333334,288)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g22">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path20" />
          </g>
        </g>
      </g>
      <g
         class="connection-group"
         id="g36">
        <g
           class="arrow-line"
           id="g34">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M279.19,135 L318.18,193.34"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path28" />
          <g
             stroke="#000"
             transform="matrix(-0.5557153433806965,-0.8313726343411085,0.8313726343411085,-0.5557153433806965,319.29274611398966,195.00000000000006)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g32">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path30" />
          </g>
        </g>
      </g>
      <g
         class="connection-group"
         id="g46">
        <g
           class="arrow-line"
           id="g44">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M271.35,49 L270.67,107"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path38" />
          <g
             stroke="#000"
             transform="matrix(0.011693439485246033,-0.999931629399233,0.999931629399233,0.011693439485246033,270.6511627906977,109)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g42">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path40" />
          </g>
        </g>
      </g>
      <g
         class="connection-group"
         id="g56">
        <g
           class="arrow-line"
           id="g54">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M133.25,315 L156.31,372.15"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path48" />
          <g
             stroke="#000"
             transform="matrix(-0.3742829223794759,-0.9273145604459574,0.9273145604459574,-0.3742829223794759,157.06181818181818,374)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g52">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path50" />
          </g>
        </g>
      </g>
      <g
         class="connection-group"
         id="g66">
        <g
           class="arrow-line"
           id="g64">
          <path
             class="connection real"
             stroke-dasharray=""
             d="  M534.83,314 L519,370.08"
             style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
             id="path58" />
          <g
             stroke="#000"
             transform="matrix(0.271776393576737,-0.9623604272279812,0.9623604272279812,0.271776393576737,518.4557823129252,372)"
             style="stroke: rgb(0, 0, 0); stroke-width: 1;"
             id="g62">
            <path
               d=" M10.93,-3.29 Q4.96,-0.45 0,0 Q4.96,0.45 10.93,3.29"
               id="path60" />
          </g>
        </g>
      </g>
    </g>
    <g
       id="g98">
      <g
         id="g72">
        <rect
           rx="0"
           ry="0"
           x="44"
           y="23"
           width="455"
           height="26"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect70" />
      </g>
      <g
         id="g76">
        <rect
           rx="0"
           ry="0"
           x="94"
           y="109"
           width="353"
           height="26"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect74" />
      </g>
      <g
         id="g80">
        <rect
           rx="0"
           ry="0"
           x="83"
           y="195"
           width="504"
           height="47"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect78" />
      </g>
      <g
         id="g84">
        <rect
           rx="0"
           ry="0"
           x="49"
           y="289"
           width="158"
           height="26"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect82" />
      </g>
      <g
         id="g88">
        <rect
           rx="0"
           ry="0"
           x="466"
           y="288"
           width="145"
           height="26"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect86" />
      </g>
      <g
         id="g92">
        <rect
           rx="0"
           ry="0"
           x="31"
           y="374"
           width="305"
           height="131"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect90" />
      </g>
      <g
         id="g96">
        <rect
           rx="0"
           ry="0"
           x="339"
           y="372"
           width="316"
           height="152"
           style="stroke: rgb(0, 0, 0); stroke-width: 1; fill: none; fill-opacity: 1;"
           id="rect94" />
      </g>
    </g>
    <g
       id="g100" />
  </svg>
  <svg
     width="660"
     height="546.328125"
     style="width:660px;height:546.328125px;font-family:Asana-Math, Asana;background:#FFF;"
     version="1.1"
     id="svg220">
    <g
       id="g110">
      <g
         id="g108">
        <g
           id="g106">
          <text
             x="269.21191"
             y="39.328125"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-align:center;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-anchor:middle;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text104">Objective: To determine the enthalpy changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g
       id="g118">
      <g
         id="g116">
        <g
           id="g114">
          <text
             x="267.81787"
             y="127.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-align:center;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-anchor:middle;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text112">Before we do so, we need to learn a few defintions. </text>
        </g>
      </g>
    </g>
    <g
       id="g132"
       transform="translate(0,12)">
      <g
         id="g124">
        <g
           id="g122">
          <text
             x="87.328125"
             y="199.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text120">Now that we've learned these definitions, we can start finding the enthalpy </text>
        </g>
      </g>
      <g
         id="g130">
        <g
           id="g128">
          <text
             x="87.328125"
             y="220.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text126">changes of various reactions. </text>
        </g>
      </g>
    </g>
    <g
       id="g140"
       transform="translate(0,12)">
      <g
         id="g138">
        <g
           id="g136">
          <text
             x="127.06104"
             y="293.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none;text-anchor:middle;text-align:center"
             id="text134">Experimental methods</text>
        </g>
      </g>
    </g>
    <g
       id="g148">
      <g
         id="g146">
        <g
           id="g144">
          <text
             x="537.83911"
             y="306.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-align:center;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;text-anchor:middle;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text142">Theoretical methods</text>
        </g>
      </g>
    </g>
    <g
       id="g182"
       transform="translate(0,12)">
      <g
         id="g154">
        <g
           id="g152">
          <text
             x="35.328125"
             y="378.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text150">- Used to determine enthalpy change of </text>
        </g>
      </g>
      <g
         id="g160">
        <g
           id="g158">
          <text
             x="35.328125"
             y="399.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text156">combustion for various liquid (usually </text>
        </g>
      </g>
      <g
         id="g166">
        <g
           id="g164">
          <text
             x="35.328125"
             y="420.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text162">combustible liquid fuels)</text>
        </g>
      </g>
      <g
         id="g168" />
      <g
         id="g174">
        <g
           id="g172">
          <text
             x="35.328125"
             y="462.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text170">- Used to determine enthalpy change when </text>
        </g>
      </g>
      <g
         id="g180">
        <g
           id="g178">
          <text
             x="35.328125"
             y="483.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text176">two liquids reacts (usually acids and bases). </text>
        </g>
      </g>
    </g>
    <g
       id="g218"
       transform="translate(0,14)">
      <g
         id="g188">
        <g
           id="g186">
          <text
             x="343.32812"
             y="376.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text184">Rely on Hess's law. </text>
        </g>
      </g>
      <g
         id="g190" />
      <g
         id="g196">
        <g
           id="g194">
          <text
             x="343.32812"
             y="418.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text192">- Enthalpy change of formation for compounds</text>
        </g>
      </g>
      <g
         id="g202">
        <g
           id="g200">
          <text
             x="343.32812"
             y="439.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text198">are used.</text>
        </g>
      </g>
      <g
         id="g204" />
      <g
         id="g210">
        <g
           id="g208">
          <text
             x="343.32812"
             y="481.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text206">- Bond enthalpies are also used to calculate </text>
        </g>
      </g>
      <g
         id="g216">
        <g
           id="g214">
          <text
             x="343.32812"
             y="502.32812"
             style="font-style:normal;font-weight:400;font-size:15px;font-family:Arial, Helvetica, sans-serif;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;white-space:pre;fill:#000000;fill-opacity:1;stroke:none"
             id="text212">the enthalpy change accompying a reaction</text>
        </g>
      </g>
    </g>
  </svg>
</svg>

结果:

使用新 svg 编译的结果


使用 tikz?

另一个选择是使用 tikz 制作此图表,这样做非常简单:https://tikz.dev/gd

这是一个半手动定位的示例,不使用图库:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning} 

\begin{document}

\begin{tikzpicture}

\draw
 (0,0) node[draw] (Obj) {Objective etc.}
 +(0,-1) node[draw] (Before) {Before etc}
 (Before) +(0,-1) node[draw, below=of Before, text width=5cm, align=center] (Now) {Now that we've learned these definitions, we can start finding the enthalpy changes of various reactions. }
 (Now) +(0,-1) coordinate (center)
 node[draw, below left=of Now] (Exp) {Exp}
 node[draw, below right=of Now] (Th) {Theoretical}


 node[draw, below=of Exp, text width=4cm] (Exptxt) {- Used to determine enthalpy change when two liquids reacts (usually acids and bases). }
 
 node[draw, below=of Th, text width=4cm] (Thtxt) {Rely on Hess's law. \\ - Enthalpy change of formation for compounds are used. \\ - Bond enthalpies are also used to calculate the enthalpy change accompying a reaction}
;

\path[->]
 (Obj) edge (Before)
 (Before) edge (Now)
 (Now) edge (Exp)
 edge (Th)
 (Th) edge (Thtxt)
 (Exp) edge (Exptxt) 
;

\end{tikzpicture}

\end{document}

使用 tikz 编译的结果

相关内容