├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── pull_request_template.md └── workflows │ ├── black.yml │ ├── build_docs.yml │ ├── pylint.yml │ ├── tests.yml │ └── tests_docs.yml ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── docs ├── Makefile ├── cmdlineguide.rst ├── code │ ├── articulated_leg_calf.tex │ ├── articulated_leg_coordinate.tex │ ├── articulated_leg_foot.tex │ ├── articulated_leg_recombine.tex │ ├── articulated_leg_simple.tex │ ├── articulated_leg_thigh.tex │ └── articulated_leg_torso.tex ├── conf.py ├── contribute.rst ├── example.rst ├── img │ ├── articulated_leg.pdf │ ├── articulated_leg.svg │ ├── articulated_leg_angled.png │ ├── example.png │ └── inkscape_example_articulated_leg.png ├── index.rst ├── inkscapeguide.rst ├── install.rst ├── limitation.rst ├── make.bat └── moduleguide.rst ├── logo └── svg2tikz.svg ├── poetry.lock ├── pylintrc ├── pyproject.toml ├── scripts └── svg2tikz ├── svg2tikz ├── .jukit │ └── .jukit_info.json ├── __init__.py ├── tikz_export.py ├── tikz_export_effect.inx └── tikz_export_output.inx └── tests ├── __init__.py ├── common.py ├── other └── inkscape_logo.png ├── test_complete_files.py ├── test_geometrical_functions.py ├── test_parsing.py ├── test_svg2tikz.py ├── test_tikz_path_exporter.py ├── test_utility_functions.py ├── testdest ├── README.md ├── convert_svg_output_file └── transform_noreversey.tex └── testfiles ├── R_letter_with_arc.svg ├── R_letter_with_arc.tex ├── arrows_marking.svg ├── attribute_texmode.svg ├── attribute_texmode.tex ├── blocs_and_groups.svg ├── blocs_and_groups.tex ├── circle.svg ├── circle.tex ├── circle_verbose.svg ├── circle_verbose.tex ├── crop.svg ├── crop.tex ├── curves.svg ├── curves.tex ├── display_none_in_group.svg ├── display_none_in_group.tex ├── ellipse.svg ├── ellipse.tex ├── ellipse_noreversey.tex ├── image.svg ├── image.tex ├── line.svg ├── line.tex ├── lines_style.svg ├── lines_style.tex ├── nodes_and_transform.svg ├── nodes_and_transform.tex ├── pentagone_round_corner.svg ├── pentagone_round_corner.tex ├── polylines_polygones.svg ├── polylines_polygones.tex ├── rectangle.svg ├── rectangle.tex ├── rectangle_wrap.svg ├── rectangle_wrap.tex ├── s_command_letter.svg ├── s_command_letter.tex ├── s_command_no_previous_bezier.svg ├── s_command_no_previous_bezier.tex ├── switch_simple.svg ├── switch_simple_noverbose.tex ├── switch_simple_verbose.tex ├── symbol_and_use.svg ├── symbol_and_use.tex ├── text.svg ├── text.tex ├── text_fill_color.svg ├── text_fill_color.tex ├── text_noreversey.tex ├── transform.svg ├── transform.tex ├── transform_noreversey.tex └── unicode.svg /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | *.png binary -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Setup:** 14 | - Mode: inkscape/python package/shell tool 15 | - SVG2TikZ version: [e.g. 1.2 or commit] 16 | - OS version: [e.g. Windows 11/macOS 12.6.3/Debian 11] 17 | - Inkscape version: [e.g. 1.1] when using with inkscape 18 | 19 | **To Reproduce** 20 | - Input SVG 21 | - Output result 22 | - Options 23 | 24 | 25 | **Expected behavior** 26 | A clear and concise description of what you expected to happen. 27 | 28 | **Additional context** 29 | Add any other context about the problem here. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Description 2 | 3 | Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. 4 | 5 | Fixes # (issue) 6 | 7 | ## Type of change 8 | 9 | Please delete options that are not relevant. 10 | 11 | - [ ] Bug fix (non-breaking change which fixes an issue) 12 | - [ ] New feature (non-breaking change which adds functionality) 13 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 14 | - [ ] This change requires a documentation update 15 | 16 | # How Has This Been Tested? 17 | 18 | Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration 19 | 20 | - [ ] Test A 21 | - [ ] Test B 22 | 23 | 24 | # Checklist: 25 | 26 | - [ ] My code follows the style guidelines of this project (black/pylint) 27 | - [ ] I have updated the changelog with the corresponding changes 28 | - [ ] I have performed a self-review of my code 29 | - [ ] I have commented my code, particularly in hard-to-understand areas 30 | - [ ] I have made corresponding changes to the documentation 31 | - [ ] I have added tests that prove my fix is effective or that my feature works 32 | - [ ] New and existing unit tests pass locally with my changes 33 | -------------------------------------------------------------------------------- /.github/workflows/black.yml: -------------------------------------------------------------------------------- 1 | name: Formating with black 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v3 10 | - uses: psf/black@stable 11 | with: 12 | version: "23.1.0" 13 | -------------------------------------------------------------------------------- /.github/workflows/build_docs.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Deploy static content to Pages 3 | 4 | on: 5 | # Runs on pushes targeting the default branch 6 | push: 7 | branches: ["master"] 8 | 9 | # Allows you to run this workflow manually from the Actions tab 10 | workflow_dispatch: 11 | 12 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 13 | permissions: 14 | contents: read 15 | pages: write 16 | id-token: write 17 | 18 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 19 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 20 | concurrency: 21 | group: "pages" 22 | cancel-in-progress: true 23 | 24 | jobs: 25 | # Single deploy job since we're just deploying 26 | deploy: 27 | permissions: write-all 28 | environment: 29 | name: github-pages 30 | url: ${{ steps.deployment.outputs.page_url }} 31 | runs-on: ubuntu-latest 32 | steps: 33 | - name: Checkout 34 | uses: actions/checkout@v4 35 | 36 | - name: Install Poetry 37 | run: pipx install poetry 38 | - name: Install Python 39 | uses: actions/setup-python@v5 40 | with: 41 | python-version: '3.11' 42 | cache: poetry 43 | - name: Setup Pages 44 | uses: actions/configure-pages@v4 45 | - name: Install local Python package 46 | run: poetry install --only docs 47 | - name: Setup Pages 48 | uses: actions/configure-pages@v4 49 | - name: Build docs 50 | run: cd docs && poetry run make html 51 | - name: Upload artifact 52 | uses: actions/upload-pages-artifact@v3 53 | with: 54 | # Upload entire repository 55 | path: 'docs/_build/html' 56 | - name: Deploy to GitHub Pages 57 | id: deployment 58 | uses: actions/deploy-pages@v4 59 | -------------------------------------------------------------------------------- /.github/workflows/pylint.yml: -------------------------------------------------------------------------------- 1 | name: Linting with Pylint 2 | on: [pull_request] 3 | 4 | jobs: 5 | build: 6 | runs-on: ubuntu-latest 7 | name: Checks with pylint 8 | steps: 9 | 10 | - name: Install dependencies 11 | run: sudo apt-get install libcairo2-dev libjpeg-dev libgirepository-1.0-dev libgirepository-2.0-dev libxml2-dev libxslt1-dev 12 | 13 | - name: Checkout branch 14 | uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 17 | 18 | - name: Get changed files 19 | id: changed-python 20 | uses: tj-actions/changed-files@v46 21 | with: 22 | files: | 23 | **.py 24 | #fetch_depth: 0 25 | 26 | - name: Install python 27 | if: steps.changed-python.outputs.any_changed == 'true' 28 | uses: actions/setup-python@v3 29 | with: 30 | python-version: "3.11" 31 | 32 | 33 | - run: pip install --upgrade pip 34 | if: steps.changed-python.outputs.any_changed == 'true' 35 | 36 | - run: pip install poetry 37 | if: steps.changed-python.outputs.any_changed == 'true' 38 | 39 | - run: poetry install --with dev 40 | if: steps.changed-python.outputs.any_changed == 'true' 41 | 42 | 43 | - run: poetry run pylint --rcfile=pylintrc ${{ steps.changed-python.outputs.all_changed_files }} 44 | if: steps.changed-python.outputs.any_changed == 'true' 45 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Python Tests 2 | on: [pull_request] 3 | 4 | jobs: 5 | build: 6 | runs-on: ubuntu-latest 7 | name: Checks unittest 8 | strategy: 9 | matrix: 10 | python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] 11 | 12 | steps: 13 | - name: Checkout branch 14 | uses: actions/checkout@v4 15 | 16 | - name: Get changed files 17 | id: changed-python 18 | uses: tj-actions/changed-files@v46 19 | with: 20 | files: | 21 | **.py 22 | #fetch_depth: 0 23 | 24 | - name: Set up Python ${{ matrix.python-version }} 25 | if: steps.changed-python.outputs.any_changed == 'true' 26 | uses: actions/setup-python@v5 27 | with: 28 | python-version: ${{ matrix.python-version }} 29 | allow-prereleases: true 30 | 31 | - name: Install dependencies 32 | if: steps.changed-python.outputs.any_changed == 'true' 33 | run: sudo apt-get install libcairo2-dev libjpeg-dev libgirepository-1.0-dev libgirepository-2.0-dev libxml2-dev libxslt1-dev 34 | 35 | - run: pip install --upgrade pip 36 | if: steps.changed-python.outputs.any_changed == 'true' 37 | 38 | - run: pip install poetry 39 | if: steps.changed-python.outputs.any_changed == 'true' 40 | 41 | - run: rm poetry.lock 42 | if: matrix.python-version != '3.12' && steps.changed-python.outputs.any_changed == 'true' 43 | 44 | - run: poetry lock 45 | if: matrix.python-version != '3.12' && steps.changed-python.outputs.any_changed == 'true' 46 | 47 | - run: poetry install --with dev 48 | if: steps.changed-python.outputs.any_changed == 'true' 49 | 50 | - name: Run Test 51 | if: steps.changed-python.outputs.any_changed == 'true' 52 | run: poetry run coverage run -m unittest 53 | 54 | - name: Create coverage xml 55 | if: steps.changed-python.outputs.any_changed == 'true' 56 | run: poetry run coverage xml 57 | 58 | - name: Get Cover 59 | if: steps.changed-python.outputs.any_changed == 'true' 60 | uses: orgoro/coverage@v3.1 61 | with: 62 | coverageFile: coverage.xml 63 | token: ${{ secrets.GITHUB_TOKEN }} 64 | -------------------------------------------------------------------------------- /.github/workflows/tests_docs.yml: -------------------------------------------------------------------------------- 1 | # Simple workflow for deploying static content to GitHub Pages 2 | name: Test build of docs 3 | 4 | on: 5 | 6 | pull_request: 7 | 8 | # Allows you to run this workflow manually from the Actions tab 9 | workflow_dispatch: 10 | 11 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 12 | permissions: 13 | contents: read 14 | pages: write 15 | id-token: write 16 | 17 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 18 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 19 | concurrency: 20 | group: "pages" 21 | cancel-in-progress: true 22 | 23 | jobs: 24 | # Single deploy job since we're just deploying 25 | deploy: 26 | runs-on: ubuntu-latest 27 | steps: 28 | - name: Checkout 29 | uses: actions/checkout@v4 30 | 31 | - name: Get changed files 32 | id: changed-files 33 | uses: tj-actions/changed-files@v46 34 | with: 35 | files: "docs/*" 36 | 37 | - name: Install Poetry 38 | if: steps.changed-files.outputs.any_changed == 'true' 39 | run: pipx install poetry 40 | 41 | - name: Install Python 42 | if: steps.changed-files.outputs.any_changed == 'true' 43 | uses: actions/setup-python@v4 44 | with: 45 | python-version: '3.11' 46 | cache: poetry 47 | 48 | - name: Install dependencies 49 | if: steps.changed-files.outputs.any_changed == 'true' 50 | run: sudo apt-get install libcairo2-dev libjpeg-dev libgirepository-1.0-dev libgirepository-2.0-dev libxml2-dev libxslt1-dev 51 | 52 | - name: Setup Pages 53 | if: steps.changed-files.outputs.any_changed == 'true' 54 | uses: actions/configure-pages@v2 55 | - name: Install local Python package 56 | if: steps.changed-files.outputs.any_changed == 'true' 57 | run: poetry install --with docs 58 | - name: Setup Pages 59 | if: steps.changed-files.outputs.any_changed == 'true' 60 | uses: actions/configure-pages@v3 61 | - name: Build docs 62 | if: steps.changed-files.outputs.any_changed == 'true' 63 | run: cd docs && poetry run make html 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .idea/ 3 | docs/_build/ 4 | *.egg-info/ 5 | tests/tmp/ 6 | .settings/ 7 | .project 8 | .pydevproject 9 | *.log 10 | venv/* 11 | 12 | # Publishing 13 | dist/* 14 | 15 | # Tex files 16 | *.aux 17 | *.fdb_latexmk 18 | *.fls 19 | *.synctex.gz 20 | tests/testfiles/*.pdf 21 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "2.7" 4 | - "3.4" 5 | 6 | install: 7 | - pip install . 8 | 9 | # command to run tests 10 | script: nosetests 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [Unreleased] 4 | 5 | ### Added 6 | ### Changed 7 | ### Deprecated 8 | ### Removed 9 | ### Fixed 10 | ### Security 11 | 12 | ## v3.3.2 - 30/05/2025 13 | 14 | ### Added 15 | - Extended exporting to clipboard functionality to support wayland 16 | ### Changed 17 | ### Deprecated 18 | ### Removed 19 | ### Fixed 20 | - S command were not correctly handled in the path if the previous command were not an S or a C 21 | ### Security 22 | 23 | ## v3.3.1 - 24/05/2025 24 | 25 | ### Added 26 | - Adding troubleshooting section in the README 27 | ### Changed 28 | ### Deprecated 29 | ### Removed 30 | ### Fixed 31 | - Deploy on the github pages 32 | - Update lxml version to work with python 3.13 33 | - A rectangle with two corner radius will use the smallest one 34 | ### Security 35 | 36 | ## v3.3.0 - 12/01/2025 37 | 38 | ### Added 39 | ### Changed 40 | ### Deprecated 41 | ### Removed 42 | ### Fixed 43 | - Fix `get-shape-inside-function` with new inkex 44 | ### Security 45 | 46 | ## v3.2.1 - 24/09/2024 47 | 48 | ### Added 49 | - Adding support for the S command letter in svg 50 | 51 | ## v3.2.0 - 30/08/2024 52 | 53 | ### Added 54 | - Adding info about the dependencies and how to contribute in the README 55 | - Adding test for the arc direction 56 | ### Fixed 57 | - Fixing the latex build of the docs 58 | - Fixing some arc were not rendered correctly by tikz 59 | 60 | ## v3.1.0 - 19/05/2024 61 | 62 | ### Added 63 | - Adding option to specify texmode via a SVG attribute (see --texmode) 64 | - Adding tests to improve the coverage of the code 65 | ### Changed 66 | ### Deprecated 67 | ### Removed 68 | ### Fixed 69 | - Fixed string encoding exception when using stdout as output 70 | - Fixing multiple bugs along the code related to the news tests to improve the coverage 71 | - Fixing typo in github action for pylint and tests 72 | ### Security 73 | 74 | ## v3.0.1 - 14/01/2024 75 | 76 | ### Added 77 | - Version is now displayed in the inkscape extension 78 | ### Changed 79 | ### Deprecated 80 | ### Removed 81 | ### Fixed 82 | - Fix bug with arc where angles values were not replaced 83 | - Fix trailing slash on shebang 84 | ### Security 85 | 86 | ## v3.0.0 - 12/12/2023 87 | 88 | ### Added 89 | - Adding support for text-anchor 90 | - Rounding of all values + options to change the number of after decimal 91 | - News tests for complete files 92 | - Cleaning of the comments 93 | - Basic colors are not redefined anymore 94 | - Adding logo for SVG2TikZ 95 | - Adding theme for doc of SVG2TikZ 96 | - Adding autodoc 97 | - Adding basic switch tag handle 98 | - Adding failsafe for non defined sys.stdout.buffer 99 | - Adding list of tikz color 100 | - Adding dev dependencies group in the pyproject.toml 101 | - Adding autodoc to generate code doc 102 | - Adding example section in the doc 103 | - Adding scaling on nodes 104 | ### Changed 105 | - Using style from new inkex 106 | - Using path from new inkex 107 | - Using transform from new inkex 108 | - Using colors from new inkex 109 | - Using Vector2d from inkex instead of Point DataClass 110 | - Removing input-options and using unit from viewbox 111 | - Correcting license in the pyproject 112 | - Unify conversion of coordinate: (x, y) 113 | - Convert_file and convert_svg functions are now directly accessible from root 114 | - Try excepting non existing tags in a svg 115 | - Changing the select file option in tikz effect to new file 116 | ### Deprecated 117 | - Gradient are commented for the time being 118 | ### Removed 119 | - GraphicState class 120 | - ’nsplit’, ’chunks’, ’\_ns’, ’filter\_tag’, ’open\_anything’ functions 121 | - License in the main file 122 | ### Fixed 123 | - Transform working with --noreversey 124 | - Fixing the installation of svg2tikz as command line tool 125 | - Wrapping line now respect newline 126 | - Fixing error on treating polylines and polygones 127 | - Verbose option to add name of shapes and layers 128 | - Converting line tag 129 | - Transformation matrix for nodes 130 | ### Security 131 | 132 | ## v2.1.0 - 2023/06/28 133 | 134 | ### Added 135 | ### Changed 136 | - Update version and authors to the doc 137 | ### Deprecated 138 | ### Removed 139 | ### Fixed 140 | - Removing misplaced
leading to warning from inkscape 141 | - Typo in tag leading to mismtach and error from inkscape 142 | - No rounded corners by default 143 | - Correct unit of round corners 144 | ### Security 145 | 146 | ## v2.0.0 - 2023/05/04 147 | 148 | ### Added 149 | - Tests for all functions and class 150 | - Tests for complete svg document 151 | - Github action for running test on PR 152 | - `Kjell Magne Fauske` to authors in `pyproject.toml` 153 | - Maintainer field in `pyproject.toml` 154 | - Linting with pylint + github action 155 | - Formatting with black + github action 156 | - Doc about contributing 157 | - Template for issues 158 | - Template for pull request 159 | 160 | ### Changed 161 | - Moving the changelog from `README.md` to `CHANGELOG.md` 162 | - Updating python package info 163 | - Updating current Docs about module 164 | - Running GH action for linting and test only when python files are modified 165 | - Rework of the .inx files 166 | 167 | ### Fixed 168 | - Fixing calc_arc function 169 | - Fixing noreversy option 170 | - Fixing error on path punch variable 171 | - Fixing path selection for inkscape > 1.0.0 172 | 173 | ### Removed 174 | - to/tikzoutput option as the output option already exist 175 | 176 | ## V1.2.0 177 | - Adding option to set document unit `input-unit` and the output unit `output-unit` 178 | - Now the tikz output used the unit define by `output-unit` 179 | - Now the default behaviour will read the height of the svg and use the bottom left corner as reference 180 | - This option can be disabled with --noreversey 181 | 182 | 183 | ## V1.1.1 184 | - Supporting svg encoded in utf-8 185 | - Simple `Symbol` handling 186 | - Simple Arrow handling 187 | 188 | ## V1.1 189 | - Publishing the package to Pypi 190 | - Publishing the document to ReadTheDocs 191 | - Fixing the translate error from matrix 192 | 193 | ## V1.0 194 | - Now images can also be exported to tikz 195 | - Added a variable `/def /globalscale` to the output tikz document (standalone and tikz figure) 196 | - `/globalscale` when changed will scale the tikzfigure by transforming the vector coordinates. 197 | - `/globalscale` when changed will scale the tikzfigure by scaling the embedded images 198 | - The path element was not exported in correct coordinates. This is fixed 199 | - Added an entry to specify the path to be removed from absolute paths in the images. This is useful to work in a latex project directly 200 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Kjell Magne Fauske 2 | 3 | This program is free software; you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation; either version 2 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program; if not, write to the Free Software 15 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 | 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | SVG2TikZ Logo 4 | 5 | 6 | [![Documentation][documentation-badge]][documentation-url] 7 | [![PyPI version](https://badge.fury.io/py/svg2tikz.svg)](https://badge.fury.io/py/svg2tikz) 8 | 9 | # SVG2TikZ 3.3.X (Inkscape 1.4.x compatible) 10 | 11 | 12 | SVG2TikZ, formally known as Inkscape2TikZ ,are a set of tools for converting SVG graphics to TikZ/PGF code. 13 | This project is licensed under the GNU GPL (see the [LICENSE](/LICENSE) file). 14 | 15 | ## Documentation and installation 16 | `SVG2TikZ` is now available on pypi so you can install it with if you want to use it with a command line. You can install the package with the following command: 17 | 18 | ``` 19 | pip install svg2tikz 20 | ``` 21 | 22 | All the information to install (as an inkscape extension) and use `SVG2TikZ` can be found in our [Documentation](https://xyz2tex.github.io/svg2tikz/install.html). 23 | 24 | 25 | ## Changes and Bug fixes 26 | 27 | A complete changelog is available in the [CHANGELOG.md](CHANGELOG.md) file. 28 | 29 | 30 | [documentation-badge]: https://img.shields.io/website?up_message=Online&url=http%3A%2F%2Fxyz2tex.github.io%2Fsvg2tikz%2F&label=Doc 31 | [documentation-url]: https://xyz2tex.github.io/svg2tikz 32 | 33 | ## Dependencies and contribution 34 | All the dependencies are listed in the [pyproject.toml](pyproject.toml). There is no particular dependencies for testing. For building, the project use [poetry](https://python-poetry.org/). 35 | 36 | For more information on how to contribute, you can check the [documentation](https://xyz2tex.github.io/svg2tikz/contribute.html). 37 | 38 | ## Troubleshooting 39 | 40 | If you have error about `lxml` when trying to install `SVG2TikZ` you can check [this link](https://stackoverflow.com/questions/18025730/pygobject-2-28-6-wont-configure-no-package-gobject-introspection-1-0-found). 41 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | PAPER = 8 | BUILDDIR = _build 9 | 10 | # Internal variables. 11 | PAPEROPT_a4 = -D latex_paper_size=a4 12 | PAPEROPT_letter = -D latex_paper_size=letter 13 | ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 14 | 15 | .PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest 16 | 17 | help: 18 | @echo "Please use \`make ' where is one of" 19 | @echo " html to make standalone HTML files" 20 | @echo " dirhtml to make HTML files named index.html in directories" 21 | @echo " pickle to make pickle files" 22 | @echo " json to make JSON files" 23 | @echo " htmlhelp to make HTML files and a HTML help project" 24 | @echo " qthelp to make HTML files and a qthelp project" 25 | @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" 26 | @echo " changes to make an overview of all changed/added/deprecated items" 27 | @echo " linkcheck to check all external links for integrity" 28 | @echo " doctest to run all doctests embedded in the documentation (if enabled)" 29 | 30 | clean: 31 | -rm -rf $(BUILDDIR)/* 32 | 33 | html: 34 | $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html 35 | @echo 36 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." 37 | 38 | dirhtml: 39 | $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml 40 | @echo 41 | @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." 42 | 43 | pickle: 44 | $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle 45 | @echo 46 | @echo "Build finished; now you can process the pickle files." 47 | 48 | json: 49 | $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json 50 | @echo 51 | @echo "Build finished; now you can process the JSON files." 52 | 53 | htmlhelp: 54 | $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp 55 | @echo 56 | @echo "Build finished; now you can run HTML Help Workshop with the" \ 57 | ".hhp project file in $(BUILDDIR)/htmlhelp." 58 | 59 | qthelp: 60 | $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp 61 | @echo 62 | @echo "Build finished; now you can run "qcollectiongenerator" with the" \ 63 | ".qhcp project file in $(BUILDDIR)/qthelp, like this:" 64 | @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/svg2tikz.qhcp" 65 | @echo "To view the help file:" 66 | @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/svg2tikz.qhc" 67 | 68 | latex: 69 | $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex 70 | @echo 71 | @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." 72 | @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ 73 | "run these through (pdf)latex." 74 | 75 | changes: 76 | $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes 77 | @echo 78 | @echo "The overview file is in $(BUILDDIR)/changes." 79 | 80 | linkcheck: 81 | $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck 82 | @echo 83 | @echo "Link check complete; look for any errors in the above output " \ 84 | "or in $(BUILDDIR)/linkcheck/output.txt." 85 | 86 | doctest: 87 | $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest 88 | @echo "Testing of doctests in the sources finished, look at the " \ 89 | "results in $(BUILDDIR)/doctest/output.txt." 90 | -------------------------------------------------------------------------------- /docs/cmdlineguide.rst: -------------------------------------------------------------------------------- 1 | Command line guide 2 | ****************** 3 | 4 | You can get direct help from the command line with ``svg2tikz -h`` 5 | 6 | .. argparse:: 7 | :module: svg2tikz.tikz_export 8 | :func: return_arg_parser_doc 9 | :prog: svg2tikz 10 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_calf.tex: -------------------------------------------------------------------------------- 1 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (1.16312, 2.92339).. controls (1.11279, 2.78068) and (1.04991, 2.51646) .. (1.02337, 2.33625).. controls (0.96993, 1.97341) and (0.97082, 1.97911) .. (0.89825, 1.54901).. controls (0.86234, 1.33618) and (0.8471, 1.11987) .. (0.8573, 0.94698).. controls (0.8717, 0.65971) and (0.75582, 0.39403) .. (0.61336, 0.33848).. controls (0.5881, 0.32863) and (0.56201, 0.32539) .. (0.52692, 0.3324).. controls (0.41144, 0.3555) and (0.1986, 0.48976) .. (0.20932, 0.93085).. controls (0.21981, 1.27003) and (0.20895, 1.6992) .. (0.14059, 2.02779).. controls (0.06794, 2.37699) and (0.11809, 2.64748) .. (0.25717, 2.97495).. controls (0.33005, 3.13468) and (0.62011, 3.25057) .. (0.78457, 3.28224).. controls (0.81705, 3.28849) and (0.84463, 3.29146) .. (0.8778, 3.28371).. controls (1.00433, 3.25413) and (1.21223, 3.06852) .. (1.16312, 2.92339); 2 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_coordinate.tex: -------------------------------------------------------------------------------- 1 | \newcommand{\hipArt}{(1.3537, 6.2435)} 2 | \newcommand{\kneeArt}{(1.3537, 3.3575)} 3 | \newcommand{\ankleArt}{(1.0781, 0.6906)} 4 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_foot.tex: -------------------------------------------------------------------------------- 1 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.2806, 0.01255).. controls (1.80006, 0.0098) and (2.46455, -0.02931) .. (1.55022, 0.25983).. controls (1.46244, 0.28759) and (1.25302, 0.35957) .. (1.08461, 0.48791).. controls (0.96181, 0.56917) and (0.77457, 0.60981) .. (0.61801, 0.62088).. controls (0.58522, 0.6232) and (0.55379, 0.62422) .. (0.52323, 0.62148).. controls (0.4078, 0.61131) and (0.30498, 0.54812) .. (0.17596, 0.464).. controls (0.13929, 0.19854) and (-0.05827, 0.01311) .. (0.2806, 0.0125) -- cycle; 2 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_recombine.tex: -------------------------------------------------------------------------------- 1 | \begin{center} 2 | \tikzsetnextfilename{Test_articulated_leg} 3 | \begin{tikzpicture}[y=1cm, x=1cm, inner sep=0pt, outer sep=0pt] 4 | 5 | 6 | \input{joints_def} 7 | \input{articulated_leg/torso} 8 | 9 | \begin{scope}[rotate around={30:(hipArt)}] 10 | 11 | \input{articulated_leg/thigh} 12 | \begin{scope}[rotate around={-20:(kneeArt)}] 13 | 14 | \input{articulated_leg/calf} 15 | \begin{scope}[rotate around={10:(ankleArt)}] 16 | 17 | \input{articulated_leg/feet} 18 | \end{scope} 19 | \draw[line width=0.018cm] (ankleArt) circle(0.05); 20 | \end{scope} 21 | \draw[line width=0.018cm] (kneeArt) circle(0.05); 22 | \end{scope} 23 | \draw[line width=0.018cm] (hipArt) circle(0.05); 24 | 25 | 26 | \end{tikzpicture} 27 | \end{center} 28 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_simple.tex: -------------------------------------------------------------------------------- 1 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.18996, 6.67363).. controls (0.16754, 6.59255) and (0.16587, 6.586) .. (0.15354, 6.54586).. controls (0.14121, 6.50572) and (0.12729, 6.46367) .. (0.11179, 6.41973).. controls (-0.02653, 6.02751) and (-0.05811, 5.5991) .. (0.22882, 5.29253).. controls (0.35169, 5.23787) and (1.0929, 5.23726) .. (1.51182, 5.37904).. controls (1.51506, 5.42205) and (1.51951, 5.47389) .. (1.52318, 5.52894).. controls (1.53178, 5.65804) and (1.53761, 5.77619) .. (1.53855, 5.88105).. controls (1.5442, 5.91233) and (1.54938, 5.96152) .. (1.55409, 6.02865).. controls (1.55881, 6.09577) and (1.56455, 6.22178) .. (1.56682, 6.28381).. controls (1.5691, 6.34584) and (1.5715, 6.42702) .. (1.57298, 6.4857).. controls (1.57446, 6.54439) and (1.57524, 6.58326) .. (1.57734, 6.68764) -- cycle; 2 | 3 | 4 | 5 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.23489, 5.24417).. controls (0.24789, 5.18345) and (0.24593, 5.08146) .. (0.24092, 4.8556).. controls (0.23326, 4.50973) and (0.24308, 4.39896) .. (0.30338, 4.15382).. controls (0.37273, 3.87191) and (0.3952, 3.62892) .. (0.36992, 3.40372).. controls (0.4783, 3.10227) and (0.64618, 3.01406) .. (0.79016, 2.99682).. controls (0.81982, 2.99327) and (0.84847, 2.99273) .. (0.87976, 2.99622).. controls (1.00951, 3.01079) and (1.18465, 3.09504) .. (1.25524, 3.32276).. controls (1.25549, 3.39971) and (1.27522, 3.4903) .. (1.29886, 3.52406).. controls (1.40255, 3.67209) and (1.44593, 3.92328) .. (1.46142, 4.46525).. controls (1.4467, 4.78798) and (1.53565, 5.45383) .. (1.53855, 5.88103).. controls (1.54563, 6.16964) and (1.11475, 6.17171) .. (0.90207, 6.17244).. controls (0.84398, 6.17264) and (0.80216, 6.17274) .. (0.7554, 6.17204).. controls (0.50573, 6.16816) and (0.115, 6.14067) .. (0.23489, 5.24417); 6 | 7 | 8 | 9 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (1.16312, 2.92339).. controls (1.11279, 2.78068) and (1.04991, 2.51646) .. (1.02337, 2.33625).. controls (0.96993, 1.97341) and (0.97082, 1.97911) .. (0.89825, 1.54901).. controls (0.86234, 1.33618) and (0.8471, 1.11987) .. (0.8573, 0.94698).. controls (0.8717, 0.65971) and (0.75582, 0.39403) .. (0.61336, 0.33848).. controls (0.5881, 0.32863) and (0.56201, 0.32539) .. (0.52692, 0.3324).. controls (0.41144, 0.3555) and (0.1986, 0.48976) .. (0.20932, 0.93085).. controls (0.21981, 1.27003) and (0.20895, 1.6992) .. (0.14059, 2.02779).. controls (0.06794, 2.37699) and (0.11809, 2.64748) .. (0.25717, 2.97495).. controls (0.33005, 3.13468) and (0.62011, 3.25057) .. (0.78457, 3.28224).. controls (0.81705, 3.28849) and (0.84463, 3.29146) .. (0.8778, 3.28371).. controls (1.00433, 3.25413) and (1.21223, 3.06852) .. (1.16312, 2.92339); 10 | 11 | 12 | 13 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.2806, 0.01255).. controls (1.80006, 0.0098) and (2.46455, -0.02931) .. (1.55022, 0.25983).. controls (1.46244, 0.28759) and (1.25302, 0.35957) .. (1.08461, 0.48791).. controls (0.96181, 0.56917) and (0.77457, 0.60981) .. (0.61801, 0.62088).. controls (0.58522, 0.6232) and (0.55379, 0.62422) .. (0.52323, 0.62148).. controls (0.4078, 0.61131) and (0.30498, 0.54812) .. (0.17596, 0.464).. controls (0.13929, 0.19854) and (-0.05827, 0.01311) .. (0.2806, 0.0125) -- cycle; 14 | 15 | 16 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_thigh.tex: -------------------------------------------------------------------------------- 1 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.23489, 5.24417).. controls (0.24789, 5.18345) and (0.24593, 5.08146) .. (0.24092, 4.8556).. controls (0.23326, 4.50973) and (0.24308, 4.39896) .. (0.30338, 4.15382).. controls (0.37273, 3.87191) and (0.3952, 3.62892) .. (0.36992, 3.40372).. controls (0.4783, 3.10227) and (0.64618, 3.01406) .. (0.79016, 2.99682).. controls (0.81982, 2.99327) and (0.84847, 2.99273) .. (0.87976, 2.99622).. controls (1.00951, 3.01079) and (1.18465, 3.09504) .. (1.25524, 3.32276).. controls (1.25549, 3.39971) and (1.27522, 3.4903) .. (1.29886, 3.52406).. controls (1.40255, 3.67209) and (1.44593, 3.92328) .. (1.46142, 4.46525).. controls (1.4467, 4.78798) and (1.53565, 5.45383) .. (1.53855, 5.88103).. controls (1.54563, 6.16964) and (1.11475, 6.17171) .. (0.90207, 6.17244).. controls (0.84398, 6.17264) and (0.80216, 6.17274) .. (0.7554, 6.17204).. controls (0.50573, 6.16816) and (0.115, 6.14067) .. (0.23489, 5.24417); 2 | -------------------------------------------------------------------------------- /docs/code/articulated_leg_torso.tex: -------------------------------------------------------------------------------- 1 | 2 | \path[draw=black,fill=white,line cap=round,line width=0.01855cm] (0.18996, 6.67363).. controls (0.16754, 6.59255) and (0.16587, 6.586) .. (0.15354, 6.54586).. controls (0.14121, 6.50572) and (0.12729, 6.46367) .. (0.11179, 6.41973).. controls (-0.02653, 6.02751) and (-0.05811, 5.5991) .. (0.22882, 5.29253).. controls (0.35169, 5.23787) and (1.0929, 5.23726) .. (1.51182, 5.37904).. controls (1.51506, 5.42205) and (1.51951, 5.47389) .. (1.52318, 5.52894).. controls (1.53178, 5.65804) and (1.53761, 5.77619) .. (1.53855, 5.88105).. controls (1.5442, 5.91233) and (1.54938, 5.96152) .. (1.55409, 6.02865).. controls (1.55881, 6.09577) and (1.56455, 6.22178) .. (1.56682, 6.28381).. controls (1.5691, 6.34584) and (1.5715, 6.42702) .. (1.57298, 6.4857).. controls (1.57446, 6.54439) and (1.57524, 6.58326) .. (1.57734, 6.68764) -- cycle; 3 | -------------------------------------------------------------------------------- /docs/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # For the full list of built-in configuration values, see the documentation: 4 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 5 | 6 | # -- Project information ----------------------------------------------------- 7 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information 8 | 9 | # pylint: skip-file 10 | 11 | project = "svg2tikz" 12 | copyright = "2014, Kjell Magne Fauske, Louis Devillez" 13 | author = "Kjell Magne Fauske, Louis Devillez" 14 | release = "3.3.2" 15 | 16 | # -- General configuration --------------------------------------------------- 17 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration 18 | 19 | extensions = ["sphinxarg.ext", "sphinx.ext.autodoc"] 20 | 21 | templates_path = ["_templates"] 22 | exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] 23 | 24 | root_doc = "index" 25 | 26 | 27 | # -- Options for HTML output ------------------------------------------------- 28 | # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output 29 | 30 | html_theme = "furo" 31 | html_static_path = ["_static"] 32 | -------------------------------------------------------------------------------- /docs/contribute.rst: -------------------------------------------------------------------------------- 1 | 2 | How to contribute 3 | ***************** 4 | 5 | First of all thanks for your interest in contributing in this project. 6 | 7 | Tools 8 | ===== 9 | We used black_ and pylint_ to format and lint the code. GitHub actions are run on the merge request to check that the code is valid. 10 | 11 | .. _black: https://github.com/psf/black 12 | .. _pylint: https://github.com/pylint-dev/pylint 13 | 14 | You can directly install the dev dependencies with `poetry install --with dev` 15 | 16 | Tests 17 | ===== 18 | The tests of SVG2TikZ are written using the unittest package. You can run all the test with command `python -m unittest`. 19 | 20 | 21 | .. _unittest: https://docs.python.org/3/library/unittest.html 22 | -------------------------------------------------------------------------------- /docs/example.rst: -------------------------------------------------------------------------------- 1 | Example 2 | ======= 3 | 4 | Let's see together how to use SVG2Tikz to convert an SVG to tikz code and include it in your work. Let's take this svg of articulated_leg: 5 | 6 | .. only:: latex 7 | 8 | .. image:: img/articulated_leg.pdf 9 | 10 | .. only:: html 11 | 12 | .. image:: img/articulated_leg.svg 13 | 14 | 15 | It's composed of several paths: 16 | 17 | * A torso 18 | * A Thigh 19 | * A Calf 20 | * A Foot 21 | * 3 articulation joints: Ankle, knee and hip 22 | 23 | With the file open in inkscape, we can directly go into Extension/export/Export to tikz path. This open a new window with multiple options in several tabs. 24 | 25 | .. image:: img/inkscape_example_articulated_leg.png 26 | 27 | First we can check the option `Export to clipboard`. Then in the Tikz option we set to export only the pathcode as we do not need any particular color definition and that we will use this tex file in an another code. We click on apply and we get the following output: 28 | 29 | .. literalinclude:: code/articulated_leg_simple.tex 30 | :language: latex 31 | 32 | We can create macro for each articulation: 33 | 34 | .. literalinclude:: code/articulated_leg_coordinate.tex 35 | :language: latex 36 | 37 | We separate each path into its own file: 38 | 39 | torso.tex: 40 | 41 | .. literalinclude:: code/articulated_leg_torso.tex 42 | :language: latex 43 | 44 | thigh.tex: 45 | 46 | .. literalinclude:: code/articulated_leg_thigh.tex 47 | :language: latex 48 | 49 | calf.tex: 50 | 51 | .. literalinclude:: code/articulated_leg_calf.tex 52 | :language: latex 53 | 54 | foot.tex: 55 | 56 | .. literalinclude:: code/articulated_leg_foot.tex 57 | :language: latex 58 | 59 | 60 | We can then recombine our svg with the following code: 61 | 62 | .. literalinclude:: code/articulated_leg_recombine.tex 63 | :language: latex 64 | 65 | It allows us to control the angle between each member 66 | 67 | .. image:: img/articulated_leg_angled.png 68 | -------------------------------------------------------------------------------- /docs/img/articulated_leg.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/docs/img/articulated_leg.pdf -------------------------------------------------------------------------------- /docs/img/articulated_leg_angled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/docs/img/articulated_leg_angled.png -------------------------------------------------------------------------------- /docs/img/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/docs/img/example.png -------------------------------------------------------------------------------- /docs/img/inkscape_example_articulated_leg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/docs/img/inkscape_example_articulated_leg.png -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. svg2tikz documentation master file 2 | 3 | SVG2TikZ -- SVG to TikZ converter 4 | ================================= 5 | 6 | Svg2tikz is an Inkscape extension for exporting SVG paths as TikZ/PGF paths for LaTeX document. 7 | Svg2tikz can also be used as a command line tool or as a Python module. 8 | 9 | Contents 10 | -------- 11 | 12 | .. toctree:: 13 | :maxdepth: 2 14 | :caption: Contents: 15 | 16 | install.rst 17 | example.rst 18 | inkscapeguide.rst 19 | cmdlineguide.rst 20 | moduleguide.rst 21 | limitation.rst 22 | contribute.rst 23 | 24 | Indices and tables 25 | ================== 26 | 27 | * :ref:`genindex` 28 | * :ref:`modindex` 29 | * :ref:`search` 30 | -------------------------------------------------------------------------------- /docs/inkscapeguide.rst: -------------------------------------------------------------------------------- 1 | Inkscape guide 2 | ============== 3 | 4 | Svg2TikZ originally started out as an Inkscape extension and most users will 5 | probably use it this way. 6 | 7 | If installed properly, the extension should appear in the extensions menu under `Export`. If you 8 | can't find it see the :ref:`inkscape-install` for installation details. 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | Installation guide 2 | ****************** 3 | 4 | Svg2TikZ can be used in three different ways: 5 | 6 | * as an Inkscape extension 7 | * as a command line tool 8 | * as a python module 9 | 10 | Dependencies 11 | ============ 12 | 13 | SVG2TikZ has the following dependencies: 14 | 15 | * lxml_ (not required if SVG2TikZ is run as an inkscape extension) 16 | * xclip_ or pbcopy_ (required only if you want clipboard support on Linux or Os X) 17 | * inkex_ (not required if SVG2TiKz is run as an inkscape extension) 18 | 19 | xclip_ is a command line tools available in most Linux distributions. Use your favorite package manager to install it. pbcopy_ is a command line tool available in OS X. 20 | 21 | .. _lxml: https://lxml.de/ 22 | .. _pbcopy: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/pbcopy.1.html 23 | .. _xclip: http://sourceforge.net/projects/xclip/ 24 | .. _inkex: https://pypi.org/project/inkex/ 25 | 26 | .. _inkscape-install: 27 | 28 | Installing for use with Inkscape 29 | ================================ 30 | 31 | SVG2TikZ is not bundled with Inkscape. You therefore have to install it manually. 32 | 33 | The extension consists of the following files: 34 | 35 | * ``tikz_export.py``, extension code 36 | * ``tikz_export_effect.inx``, effect setup file 37 | * ``tikz_export_output.inx``, output setup file 38 | 39 | Which are located in the ``svg2tikz/extensions`` folder. Installing is as simple as copying the script and its INX files to the Inkscape extensions directory. The location of the extensions directory depends on which operating system you use: 40 | 41 | Windows 42 | ``C:\Program Files\Inkscape\share\inkscape\extensions\`` 43 | 44 | Linux 45 | ``/usr/share/inkscape/extensions`` *or* ``~/.config/inkscape/extensions/`` 46 | 47 | Mac 48 | ``/Applications/Inkscape.app/Contents/Resources/share/inkscape/extensions/`` *or* ``~/Library/Application Support/org.inkscape.Inkscape/config/inkscape/extensions/`` 49 | 50 | 51 | Additionally the extension has the following dependencies: 52 | 53 | * inkex_ 54 | * lxml_ 55 | 56 | The dependencies are bundled with Inkscape and normally you don't need to install them yourself. But in the case they are not her, look in the main extensions directory. You can also download them from the repository 57 | 58 | 59 | Installing for use as library or command line tool 60 | ================================================== 61 | 62 | SVG2TikZ started out as an Inkscape extension, but it can also be used as a standalone tool. 63 | 64 | Automatic installation via a package manager 65 | -------------------------------------------- 66 | 67 | SVG2TikZ is available on pypi_. You can install it directly with the following command: 68 | 69 | ``pip install svg2tikz`` 70 | 71 | .. _pypi: https://pypi.org/project/svg2tikz/ 72 | 73 | 74 | Manual installation from a Git checkout 75 | --------------------------------------- 76 | 77 | - Clone this repository from GitHub, using 78 | ``git clone https://github.com/xyz2tex/svg2tikz.git`` 79 | - ``cd`` into ``svg2tikz``. 80 | - For installation as a Python 3 package, type 81 | 82 | 83 | :: 84 | 85 | $ pip install . 86 | 87 | You should now be able to import the ``svg2tikz`` module from the 88 | Python 3 prompt without error: 89 | 90 | :: 91 | 92 | >>> import svg2tikz 93 | 94 | For more information on the use of ``svg2tikz`` as a Python module, 95 | see the :ref:`module-guide`. 96 | 97 | Installation using ``pip`` also makes available the ``svg2tikz`` 98 | command-line tool; typically (for non-root installation), it will be in 99 | the directory ``$HOME/.local/bin/``, so to run it, you need to ensure 100 | that directory is on your PATH. 101 | -------------------------------------------------------------------------------- /docs/limitation.rst: -------------------------------------------------------------------------------- 1 | Limitation 2 | ======= 3 | 4 | Here is a list of current limitations of the code: 5 | 6 | - A rectangle with two differents corner radius for the x and y coordinate will use only the smallest one of the two. To have the correct representation of the shape convert the rectangle to a path in inkscape. 7 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | REM Command file for Sphinx documentation 4 | 5 | set SPHINXBUILD=sphinx-build 6 | set BUILDDIR=_build 7 | set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . 8 | if NOT "%PAPER%" == "" ( 9 | set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% 10 | ) 11 | 12 | if "%1" == "" goto help 13 | 14 | if "%1" == "help" ( 15 | :help 16 | echo.Please use `make ^` where ^ is one of 17 | echo. html to make standalone HTML files 18 | echo. dirhtml to make HTML files named index.html in directories 19 | echo. pickle to make pickle files 20 | echo. json to make JSON files 21 | echo. htmlhelp to make HTML files and a HTML help project 22 | echo. qthelp to make HTML files and a qthelp project 23 | echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter 24 | echo. changes to make an overview over all changed/added/deprecated items 25 | echo. linkcheck to check all external links for integrity 26 | echo. doctest to run all doctests embedded in the documentation if enabled 27 | goto end 28 | ) 29 | 30 | if "%1" == "clean" ( 31 | for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i 32 | del /q /s %BUILDDIR%\* 33 | goto end 34 | ) 35 | 36 | if "%1" == "html" ( 37 | %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html 38 | echo. 39 | echo.Build finished. The HTML pages are in %BUILDDIR%/html. 40 | goto end 41 | ) 42 | 43 | if "%1" == "dirhtml" ( 44 | %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml 45 | echo. 46 | echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. 47 | goto end 48 | ) 49 | 50 | if "%1" == "pickle" ( 51 | %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle 52 | echo. 53 | echo.Build finished; now you can process the pickle files. 54 | goto end 55 | ) 56 | 57 | if "%1" == "json" ( 58 | %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json 59 | echo. 60 | echo.Build finished; now you can process the JSON files. 61 | goto end 62 | ) 63 | 64 | if "%1" == "htmlhelp" ( 65 | %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp 66 | echo. 67 | echo.Build finished; now you can run HTML Help Workshop with the ^ 68 | .hhp project file in %BUILDDIR%/htmlhelp. 69 | goto end 70 | ) 71 | 72 | if "%1" == "qthelp" ( 73 | %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp 74 | echo. 75 | echo.Build finished; now you can run "qcollectiongenerator" with the ^ 76 | .qhcp project file in %BUILDDIR%/qthelp, like this: 77 | echo.^> qcollectiongenerator %BUILDDIR%\qthelp\svg2tikz.qhcp 78 | echo.To view the help file: 79 | echo.^> assistant -collectionFile %BUILDDIR%\qthelp\svg2tikz.ghc 80 | goto end 81 | ) 82 | 83 | if "%1" == "latex" ( 84 | %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex 85 | echo. 86 | echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. 87 | goto end 88 | ) 89 | 90 | if "%1" == "changes" ( 91 | %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes 92 | echo. 93 | echo.The overview file is in %BUILDDIR%/changes. 94 | goto end 95 | ) 96 | 97 | if "%1" == "linkcheck" ( 98 | %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck 99 | echo. 100 | echo.Link check complete; look for any errors in the above output ^ 101 | or in %BUILDDIR%/linkcheck/output.txt. 102 | goto end 103 | ) 104 | 105 | if "%1" == "doctest" ( 106 | %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest 107 | echo. 108 | echo.Testing of doctests in the sources finished, look at the ^ 109 | results in %BUILDDIR%/doctest/output.txt. 110 | goto end 111 | ) 112 | 113 | :end 114 | -------------------------------------------------------------------------------- /docs/moduleguide.rst: -------------------------------------------------------------------------------- 1 | 2 | .. _module-guide: 3 | 4 | package guide 5 | ============= 6 | 7 | .. module:: svg2tikz 8 | :synopsis: Interface to the SVG to TikZ converter 9 | 10 | .. autofunction:: svg2tikz.convert_file 11 | 12 | 13 | .. autofunction:: svg2tikz.convert_svg 14 | 15 | 16 | 17 | Examples:: 18 | 19 | from svg2tikz import convert_svg 20 | 21 | var_svg = """ 22 | ... 23 | """ 24 | code = convert_svg(var_svg, ids=['1', '2', 'id2'], verbose=True) 25 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "svg2tikz" 3 | version = "3.3.2" 4 | description = "Tools for converting SVG graphics to TikZ/PGF code" 5 | authors = ["ldevillez ", " Kjell Magne Fauske "] 6 | maintainers = ["ldevillez "] 7 | license = "GPL-2.0-or-later" 8 | readme = "README.md" 9 | 10 | [tool.poetry.dependencies] 11 | python = "^3.8,<4.0" 12 | lxml = "^5.1.1" 13 | inkex = "==1.4.0" 14 | 15 | [tool.poetry.group.docs.dependencies] 16 | sphinx = ">=6.0.0" 17 | sphinx-click = ">=4.4.0" 18 | sphinx-copybutton = ">=0.5.1" 19 | sphinxext-opengraph = ">=0.7.5" 20 | furo = ">=2023.9.10" 21 | sphinx-argparse = ">=0.4.0" 22 | 23 | [tool.poetry.group.dev.dependencies] 24 | black = ">=23.1,<25.0" 25 | pylint = ">=2.16.2" 26 | coverage = ">=7.5.1" 27 | 28 | 29 | [[tool.poetry.source]] 30 | name = "inkex_gitlab" 31 | url = "https://gitlab.com/api/v4/projects/40060814/packages/pypi/simple" 32 | priority = "supplemental" 33 | 34 | [build-system] 35 | requires = ["poetry-core"] 36 | build-backend = "poetry.core.masonry.api" 37 | 38 | 39 | [tool.poetry.scripts] 40 | svg2tikz = "svg2tikz.tikz_export:main_cmdline" 41 | -------------------------------------------------------------------------------- /scripts/svg2tikz: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | try: 4 | # svg2tikz installed into system's python path? 5 | import svg2tikz 6 | except ImportError: 7 | # if not, have a look into default directory 8 | import sys, os 9 | 10 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 11 | import svg2tikz 12 | 13 | from svg2tikz.tikz_export import main_cmdline 14 | 15 | if __name__ == "__main__": 16 | main_cmdline() 17 | -------------------------------------------------------------------------------- /svg2tikz/.jukit/.jukit_info.json: -------------------------------------------------------------------------------- 1 | {"terminal": "nvimterm"} -------------------------------------------------------------------------------- /svg2tikz/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | Export main functions from SVG2tikz to be easily accessible from the package 3 | """ 4 | from .tikz_export import convert_file, convert_svg 5 | -------------------------------------------------------------------------------- /svg2tikz/tikz_export_effect.inx: -------------------------------------------------------------------------------- 1 | 2 | 3 | Export to TikZ path v3.3.2 4 | net.texample.tools.svg.export_tikz.effect 5 | tikz_export.py 6 | 7 | 8 | 9 | none 10 | false 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | false 19 | true 20 | true 21 | 1 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | false 35 | 1 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | false 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | false 64 | 65 | 66 | 67 | 74 | 75 | 78 | 79 | 80 | 81 | 82 | all 83 | 84 | 85 | 86 | 87 | 90 | 91 | -------------------------------------------------------------------------------- /svg2tikz/tikz_export_output.inx: -------------------------------------------------------------------------------- 1 | 2 | 3 | Export as TikZ code for use with LaTeX v3.3.2 4 | net.texample.tools.svg.export_tikz.output 5 | tikz_export.py 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | false 15 | true 16 | true 17 | 1 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | false 31 | 1 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | false 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | false 60 | 61 | 62 | 63 | 70 | 71 | 74 | 75 | 76 | 77 | output 78 | 79 | .tex 80 | text/plain 81 | TikZ code (*.tex) 82 | Exports drawing as TikZ code. 83 | 84 | 87 | 88 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/tests/__init__.py -------------------------------------------------------------------------------- /tests/common.py: -------------------------------------------------------------------------------- 1 | """Common SVG between tests""" 2 | 3 | SVG_2_PATH = r""" 4 | 6 | 9 | 10 | 15 | 16 | 17 | 18 | 22 | 23 | 26 | """ 27 | 28 | 29 | SVG_2_RECT = r""" 30 | 32 | 34 | Example rect01 - rectangle with sharp corners 35 | 36 | 38 | 40 | 41 | """ 42 | 43 | SVG_3_RECT = r""" 44 | 46 | 48 | Example rect01 - rectangle with sharp corners 49 | 50 | 52 | 54 | 56 | 57 | """ 58 | 59 | SVG_4_RECT = r""" 60 | 62 | 64 | Example rect01 - rectangle with sharp corners 65 | 66 | 68 | 70 | 72 | 74 | 75 | """ 76 | 77 | SVG_EMPTY = r""" 78 | 80 | 82 | 83 | """ 84 | 85 | 86 | SVG_TEXT = r""" 87 | 89 | 91 | Example rect01 - rectangle with sharp corners 92 | Test Text 100 | 101 | """ 102 | 103 | SVG_TEXT_BLUE = r""" 104 | 106 | 108 | Example text01 - 'Hello, out there' in blue 109 | 110 | a%b 111 | """ 112 | 113 | SVG_ARROW = r""" 114 | 116 | 119 | 120 | 125 | 126 | 127 | 128 | 131 | """ 132 | 133 | SVG_PAINT = r""" 134 | 136 | 139 | Example rect01 - rectangle with sharp corners 140 | 141 | 143 | 144 | """ 145 | 146 | SVG_DEFS = r""" 147 | 149 | 151 | Example Use01 - Simple case of 'use' on a 'rect' 152 | 153 | 154 | 155 | 156 | 157 | 159 | """ 160 | 161 | SVG_NO_HEIGHT = r""" 162 | 164 | 165 | 167 | """ 168 | -------------------------------------------------------------------------------- /tests/other/inkscape_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xyz2tex/svg2tikz/812279cd4435b5d50d7f6137b959758940a9d771/tests/other/inkscape_logo.png -------------------------------------------------------------------------------- /tests/test_complete_files.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test top level functions of svg2tikz""" 3 | import unittest 4 | 5 | import sys 6 | import os 7 | import io 8 | 9 | # Use local svg2tikz version 10 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 11 | 12 | # pylint: disable=wrong-import-position 13 | from svg2tikz import convert_file 14 | 15 | 16 | # pylint: disable=too-many-public-methods 17 | def create_test_from_filename(filename, utest, filename_output=None, **kwargs): 18 | """ 19 | Function to test the complete conversion with svg2tikz. 20 | The svg should be located in tests/testsfiles/XXX.svg 21 | The tex should be located in tests/testsfiles/XXX.tex 22 | """ 23 | filepath_input = f"tests/testfiles/{filename}" 24 | filepath_output = f"tests/testdest/{filename}.tex" 25 | 26 | if filename_output is None: 27 | filepath_test = f"{filepath_input}.tex" 28 | else: 29 | filepath_test = f"tests/testfiles/{filename_output}.tex" 30 | 31 | convert_file(f"{filepath_input}.svg", output=filepath_output, **kwargs) 32 | 33 | with io.open(filepath_test, encoding="utf-8") as fi: 34 | with io.open(filepath_output, encoding="utf-8") as fo: 35 | utest.assertListEqual( 36 | list(fi), 37 | list(fo), 38 | ) 39 | 40 | os.remove(filepath_output) 41 | 42 | 43 | class TestCompleteFiles(unittest.TestCase): 44 | """Class test for complete SVG""" 45 | 46 | def test_crop(self): 47 | """Test convert with crop""" 48 | filename = "crop" 49 | create_test_from_filename(filename, self, crop=True) 50 | 51 | def test_line_shape(self): 52 | """Test complete convert line tag""" 53 | filename = "line" 54 | create_test_from_filename(filename, self, markings="interpret") 55 | 56 | def test_linestyle(self): 57 | """Test complete convert line with different style""" 58 | filename = "lines_style" 59 | create_test_from_filename(filename, self, markings="interpret") 60 | 61 | def test_rectangle(self): 62 | """Test complete convert rectangle""" 63 | filename = "rectangle" 64 | create_test_from_filename(filename, self) 65 | 66 | def test_circle(self): 67 | """Test complete convert circle""" 68 | filename = "circle" 69 | create_test_from_filename(filename, self) 70 | 71 | def test_circle_verbose(self): 72 | """Test complete convert circle""" 73 | filename = "circle_verbose" 74 | create_test_from_filename(filename, self, verbose=True) 75 | 76 | def test_ellipse(self): 77 | """Test complete convert ellipse""" 78 | filename = "ellipse" 79 | create_test_from_filename(filename, self) 80 | create_test_from_filename( 81 | filename, self, noreversey=True, filename_output="ellipse_noreversey" 82 | ) 83 | 84 | def test_polylines_polygones(self): 85 | """Test complete convert polylines and polygones""" 86 | filename = "polylines_polygones" 87 | create_test_from_filename(filename, self) 88 | 89 | def test_pentagone_round_corner(self): 90 | """Test complete convert pentagone with round corner""" 91 | filename = "pentagone_round_corner" 92 | create_test_from_filename(filename, self) 93 | 94 | def test_curves(self): 95 | """Test curve C and Q""" 96 | filename = "curves" 97 | create_test_from_filename(filename, self) 98 | 99 | def test_display_none_in_groups(self): 100 | """Test complete convert with none display""" 101 | filename = "display_none_in_group" 102 | create_test_from_filename(filename, self) 103 | 104 | def test_display_blocs_and_groups(self): 105 | """Test complete convert blocs and groups""" 106 | filename = "blocs_and_groups" 107 | create_test_from_filename(filename, self) 108 | 109 | def test_transforms(self): 110 | """Test complete convert transform""" 111 | filename = "transform" 112 | create_test_from_filename(filename, self) 113 | create_test_from_filename( 114 | filename, self, filename_output="transform_noreversey", noreversey=True 115 | ) 116 | 117 | def test_image(self): 118 | """Test complete convert image""" 119 | filename = "image" 120 | create_test_from_filename(filename, self) 121 | 122 | def test_symbol_and_use(self): 123 | """Test complete convert symbol and use""" 124 | filename = "symbol_and_use" 125 | create_test_from_filename(filename, self) 126 | 127 | def test_text(self): 128 | """Test complete convert text""" 129 | filename = "text" 130 | create_test_from_filename(filename, self) 131 | create_test_from_filename( 132 | filename, self, filename_output="text_noreversey", noreversey=True 133 | ) 134 | 135 | def test_switch(self): 136 | """Test complete convert simple switch case""" 137 | filename = "switch_simple" 138 | create_test_from_filename( 139 | filename, self, filename_output="switch_simple_noverbose" 140 | ) 141 | create_test_from_filename( 142 | filename, self, verbose=True, filename_output="switch_simple_verbose" 143 | ) 144 | 145 | def test_text_fill_color(self): 146 | """Test complete convert text with color case""" 147 | filename = "text_fill_color" 148 | create_test_from_filename(filename, self) 149 | 150 | def test_wrap(self): 151 | """Test complete convert wrap option""" 152 | filename = "rectangle_wrap" 153 | create_test_from_filename(filename, self, wrap=True) 154 | 155 | def test_nodes_and_transform(self): 156 | """Test complete convert transformation on nodes""" 157 | filename = "nodes_and_transform" 158 | create_test_from_filename(filename, self) 159 | 160 | def test_attribute_texmode(self): 161 | """Test per SVG object texmode with attribute""" 162 | filename = "attribute_texmode" 163 | create_test_from_filename( 164 | filename, self, texmode="attribute", texmode_attribute="data-texmode" 165 | ) 166 | 167 | def test_arc_direction(self): 168 | """Test per SVG object texmode with attribute""" 169 | # Example taken from svg of the flag of the state of California 170 | filename = "R_letter_with_arc" 171 | create_test_from_filename(filename, self) 172 | 173 | def test_s_command(self): 174 | """Test svg with S command inside it""" 175 | # Example taken from svg of the flag of the state of California 176 | filename = "s_command_letter" 177 | create_test_from_filename(filename, self) 178 | 179 | def test_s_command(self): 180 | """Test svg with S command inside it without previous bezier curve""" 181 | # Example taken from svg of #232 182 | filename = "s_command_no_previous_bezier" 183 | create_test_from_filename(filename, self) 184 | 185 | 186 | if __name__ == "__main__": 187 | unittest.main() 188 | -------------------------------------------------------------------------------- /tests/test_geometrical_functions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test all geometrical functions of svg2tikz""" 3 | import unittest 4 | 5 | import sys 6 | import os 7 | 8 | import inkex 9 | 10 | # Use local svg2tikz version 11 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 12 | 13 | # pylint: disable=wrong-import-position 14 | from svg2tikz.tikz_export import calc_arc 15 | 16 | 17 | # pylint: disable=too-many-public-methods 18 | class TestGeometricalFunctions(unittest.TestCase): 19 | """Test all functions related to geometry from tikz_export""" 20 | 21 | # pylint: disable=too-many-statements 22 | def test_calc_arc(self): 23 | """Test arc computing 24 | 25 | Value determined with visual aid""" 26 | 27 | cp = inkex.transforms.Vector2d(3.0, 3.0) 28 | r_i = inkex.transforms.Vector2d(2.0, 2.0) 29 | ang = 0.0 30 | fa = 0.0 31 | fs = 0.0 32 | pos = inkex.transforms.Vector2d(3.0, 3.0) 33 | start_ang_o, end_ang_o, r_o = calc_arc(cp, r_i, ang, fa, fs, pos) 34 | true_start_ang = 0 35 | true_end_ang = 0 36 | true_r = inkex.transforms.Vector2d(2, 2) 37 | self.assertEqual(start_ang_o, true_start_ang) 38 | self.assertEqual(end_ang_o, true_end_ang) 39 | self.assertEqual(true_r.x, r_o.x) 40 | self.assertEqual(true_r.y, r_o.y) 41 | 42 | cp = inkex.transforms.Vector2d(3.0, 3.0) 43 | r_i = inkex.transforms.Vector2d(1.0, 2.0) 44 | ang = 0.0 45 | fa = 0.0 46 | fs = 0.0 47 | pos = inkex.transforms.Vector2d(3.0, 11.0) 48 | start_ang_o, end_ang_o, r_o = calc_arc(cp, r_i, ang, fa, fs, pos) 49 | true_start_ang = -90 50 | true_end_ang = -270 51 | true_r = inkex.transforms.Vector2d(2, 4) 52 | 53 | self.assertEqual(start_ang_o, true_start_ang) 54 | self.assertEqual(end_ang_o, true_end_ang) 55 | self.assertEqual(true_r.x, r_o.x) 56 | self.assertEqual(true_r.y, r_o.y) 57 | 58 | cp = inkex.transforms.Vector2d(2.0351807, 26.0215522) 59 | r_i = inkex.transforms.Vector2d(3.7795276, 7.559055100000002) 60 | ang = 0.0 61 | fa = 0.0 62 | fs = 0.0 63 | pos = inkex.transforms.Vector2d(1.5789307000000004, 22.428779199999997) 64 | start_ang_o, end_ang_o, r_o = calc_arc(cp, r_i, ang, fa, fs, pos) 65 | true_start_ang = -0.05758947401401947 66 | true_end_ang = -28.443965116484787 67 | true_r = inkex.transforms.Vector2d(3.7795276, 7.559055100000002) 68 | 69 | self.assertEqual(start_ang_o, true_start_ang) 70 | self.assertEqual(end_ang_o, true_end_ang) 71 | self.assertEqual(true_r.x, r_o.x) 72 | self.assertEqual(true_r.y, r_o.y) 73 | 74 | fa = 1.0 75 | start_ang_o, end_ang_o, r_o = calc_arc(cp, r_i, ang, fa, fs, pos) 76 | true_start_ang = 151.55603488351522 77 | true_end_ang = -180.05758947401404 78 | true_r = inkex.transforms.Vector2d(3.7795276, 7.559055100000002) 79 | 80 | self.assertEqual(start_ang_o, true_start_ang) 81 | self.assertEqual(end_ang_o, true_end_ang) 82 | self.assertEqual(true_r.x, r_o.x) 83 | self.assertEqual(true_r.y, r_o.y) 84 | 85 | fs = 1.0 86 | start_ang_o, end_ang_o, r_o = calc_arc(cp, r_i, ang, fa, fs, pos) 87 | true_start_ang = -360.05758947401404 88 | true_end_ang = -28.443965116484787 89 | true_r = inkex.transforms.Vector2d(3.7795276, 7.559055100000002) 90 | 91 | self.assertEqual(start_ang_o, true_start_ang) 92 | self.assertEqual(end_ang_o, true_end_ang) 93 | self.assertEqual(true_r.x, r_o.x) 94 | self.assertEqual(true_r.y, r_o.y) 95 | -------------------------------------------------------------------------------- /tests/test_parsing.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test all functions to parsing of svg2tikz""" 3 | import unittest 4 | 5 | import sys 6 | import os 7 | 8 | # Use local svg2tikz version 9 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 10 | 11 | # pylint: disable=wrong-import-position 12 | 13 | from svg2tikz.tikz_export import ( 14 | parse_arrow_style, 15 | marking_interpret, 16 | ) 17 | 18 | 19 | class TestParseArrow(unittest.TestCase): 20 | """Test arrow parsing""" 21 | 22 | def test_parse_arrow_style(self): 23 | """Test parse_arrow_style function""" 24 | for input_arrow, output_arrow in zip( 25 | ["Arrow1", "Arrow2", "Stop", "Triangle"], ["latex", "stealth", "|", "latex"] 26 | ): 27 | for pos in ["start", "end"]: 28 | input_arrow_style = f'marker-{pos}=url"(#{input_arrow})"' 29 | output_arrow_style = parse_arrow_style(input_arrow_style) 30 | self.assertEqual(output_arrow, output_arrow_style) 31 | 32 | def test_marking_interpret(self): 33 | """Test marking interprite function""" 34 | for input_arrow, output_arrow in zip( 35 | ["Arrow1", "Arrow2", "Stop", "Triangle"], ["latex", "stealth", "|", "latex"] 36 | ): 37 | for pos, post in zip(["start", "end"], ["", " reversed"]): 38 | input_arrow_style = f'marker-{pos}=url"(#{input_arrow})"' 39 | output_arrow_style = marking_interpret(input_arrow_style) 40 | self.assertEqual(output_arrow + post, output_arrow_style) 41 | -------------------------------------------------------------------------------- /tests/test_svg2tikz.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test top level functions of svg2tikz""" 3 | import unittest 4 | 5 | import sys 6 | import os 7 | from io import StringIO 8 | 9 | # Use local svg2tikz version 10 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 11 | 12 | # pylint: disable=wrong-import-position 13 | from svg2tikz import convert_file, convert_svg 14 | from tests.common import ( 15 | SVG_2_RECT, 16 | SVG_3_RECT, 17 | SVG_ARROW, 18 | SVG_TEXT_BLUE, 19 | SVG_DEFS, 20 | SVG_PAINT, 21 | SVG_NO_HEIGHT, 22 | ) 23 | 24 | 25 | class InterfaceTest(unittest.TestCase): 26 | """Class test for all the interfaces""" 27 | 28 | def test_basicsvg(self): 29 | """Test converting simple svg""" 30 | code = convert_file(StringIO(SVG_2_RECT)) 31 | assert "rect" in code 32 | 33 | def test_basic_codeonly(self): 34 | """Test converting basic svg with codeonly""" 35 | code = convert_file(StringIO(SVG_2_RECT), codeoutput="codeonly") 36 | assert "documentclass" not in code 37 | assert r"\begin{tikzpicture}" not in code 38 | 39 | def test_basic_figonly(self): 40 | """Test converting basic svg with figonly""" 41 | code = convert_file(StringIO(SVG_2_RECT), codeoutput="figonly") 42 | assert "documentclass" not in code 43 | assert r"\begin{tikzpicture}" in code 44 | 45 | def test_no_ids(self): 46 | """Test converting basic svg 2""" 47 | code = convert_file(StringIO(SVG_3_RECT), ids=[], verbose=True) 48 | assert "rect1" in code 49 | assert "rect2" in code 50 | 51 | def test_select_id_rect1(self): 52 | """Test converting basic svg 2 with selection""" 53 | code = convert_file(StringIO(SVG_3_RECT), ids=["rect1"], verbose=True) 54 | assert "rect1" in code 55 | assert "rect2" not in code 56 | 57 | def test_select_id_rect1and3(self): 58 | """Test converting basic svg 2 with multiple selection""" 59 | code = convert_file(StringIO(SVG_3_RECT), ids=["rect1", "rect3"], verbose=True) 60 | assert "rect1" in code 61 | assert "rect2" not in code 62 | assert "rect3" in code 63 | 64 | 65 | class PaintingTest(unittest.TestCase): 66 | """Test class to test painting""" 67 | 68 | def test_inherited_fill(self): 69 | """Testing the inherited painting""" 70 | code = convert_file(StringIO(SVG_PAINT)) 71 | self.assertTrue("fill=red" in code) 72 | 73 | 74 | class TestTextMode(unittest.TestCase): 75 | """Class to test the texmode""" 76 | 77 | def test_escape(self): 78 | """Test the escape mode""" 79 | code = convert_file(StringIO(SVG_TEXT_BLUE), codeoutput="codeonly") 80 | self.assertTrue(r"a\%b" in code) 81 | code = convert_file( 82 | StringIO(SVG_TEXT_BLUE), codeoutput="codeonly", texmode="escape" 83 | ) 84 | self.assertTrue(r"a\%b" in code) 85 | 86 | def test_raw(self): 87 | """Test the raw mode""" 88 | code = convert_file( 89 | StringIO(SVG_TEXT_BLUE), codeoutput="codeonly", texmode="raw" 90 | ) 91 | self.assertTrue(r"a%b" in code) 92 | 93 | def test_math(self): 94 | """Test the math mode""" 95 | code = convert_file( 96 | StringIO(SVG_TEXT_BLUE), codeoutput="codeonly", texmode="math" 97 | ) 98 | self.assertTrue(r"$a%b$" in code) 99 | 100 | def test_bad_textmode_option(self): 101 | """Test texmode option to attribute without texmode--attribute set""" 102 | print("hello") 103 | code = convert_file( 104 | StringIO(SVG_TEXT_BLUE), texmode="attribute", texmode_attribute=None 105 | ) 106 | self.assertEqual(code, "") 107 | 108 | 109 | class DifformSVGTest(unittest.TestCase): 110 | """Test class for limit case of SVG""" 111 | 112 | def test_no_svgheight_error(self): 113 | """Test with no height in the viewbox""" 114 | code = convert_file(StringIO(SVG_NO_HEIGHT)) 115 | self.assertTrue("rectangle" in code) 116 | 117 | 118 | class DefsTest(unittest.TestCase): 119 | """Test class for def property of SVG""" 120 | 121 | def test_no_used_defs(self): 122 | """Test when defs are not used""" 123 | code = convert_file(StringIO(SVG_DEFS)) 124 | self.assertTrue("circle" not in code) 125 | 126 | 127 | class MarkersTest(unittest.TestCase): 128 | """Test class for marker option""" 129 | 130 | def test_marker_options_ignore(self): 131 | """Test ignore option with marking""" 132 | code = convert_file( 133 | StringIO(SVG_ARROW), markings="ignore", codeoutput="codeonly" 134 | ) 135 | self.assertTrue(">" not in code) 136 | 137 | def test_marker_options_arrows(self): 138 | """Test arrows option with marking""" 139 | code = convert_file( 140 | StringIO(SVG_ARROW), markings="arrows", arrow=">", codeoutput="codeonly" 141 | ) 142 | self.assertTrue("->" in code, f'code="{code}"') 143 | 144 | 145 | class CommandlineModule(unittest.TestCase): 146 | """ 147 | Test class for the command line functions 148 | """ 149 | 150 | def test_convert_svg_output_str(self): 151 | """Test of convert_svg""" 152 | 153 | code = convert_svg( 154 | SVG_ARROW, returnstring=True, codeoutput="codeonly", indent=False 155 | ) 156 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 157 | 158 | 159 | 160 | """ 161 | self.assertEqual(truecode, code) 162 | 163 | def test_convert_svg_output_stream(self): 164 | """Test of convert_svg""" 165 | 166 | output_stream = StringIO() 167 | convert_svg( 168 | SVG_ARROW, 169 | no_output=False, 170 | returnstring=False, 171 | codeoutput="codeonly", 172 | indent=False, 173 | output=output_stream, 174 | ) 175 | 176 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 177 | 178 | 179 | 180 | """ 181 | self.assertEqual(truecode, output_stream.getvalue()) 182 | output_stream.close() 183 | 184 | def test_convert_svg_output_file(self): 185 | """Test of convert_svg""" 186 | 187 | filename = "tests/testdest/convert_svg_output_file" 188 | convert_svg( 189 | SVG_ARROW, 190 | no_output=False, 191 | returnstring=False, 192 | codeoutput="codeonly", 193 | indent=False, 194 | output=filename, 195 | ) 196 | 197 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 198 | 199 | 200 | 201 | """ 202 | with open(filename, "r", encoding="utf8") as f: 203 | self.assertEqual(truecode, f.read()) 204 | 205 | def test_convert_file_output_str(self): 206 | """Test of convert_svg""" 207 | 208 | code = convert_file( 209 | StringIO(SVG_ARROW), returnstring=True, codeoutput="codeonly", indent=False 210 | ) 211 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 212 | 213 | 214 | 215 | """ 216 | self.assertEqual(truecode, code) 217 | 218 | def test_convert_file_output_stream(self): 219 | """Test of convert_svg""" 220 | 221 | output_stream = StringIO() 222 | convert_file( 223 | StringIO(SVG_ARROW), 224 | no_output=False, 225 | returnstring=False, 226 | codeoutput="codeonly", 227 | indent=False, 228 | output=output_stream, 229 | ) 230 | 231 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 232 | 233 | 234 | 235 | """ 236 | self.assertEqual(truecode, output_stream.getvalue()) 237 | output_stream.close() 238 | 239 | def test_convert_file_output_file(self): 240 | """Test of convert_svg""" 241 | 242 | filename = "tests/testdest/convert_svg_output_file" 243 | convert_file( 244 | StringIO(SVG_ARROW), 245 | no_output=False, 246 | returnstring=False, 247 | codeoutput="codeonly", 248 | indent=False, 249 | output=filename, 250 | ) 251 | 252 | truecode = r"""\path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 253 | 254 | 255 | 256 | """ 257 | with open(filename, "r", encoding="utf8") as f: 258 | self.assertEqual(truecode, f.read()) 259 | -------------------------------------------------------------------------------- /tests/test_utility_functions.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | """Test all utily functions of svg2tikz""" 3 | import unittest 4 | 5 | import sys 6 | import os 7 | import argparse 8 | 9 | # Use local svg2tikz version 10 | sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../") 11 | 12 | # pylint: disable=wrong-import-position 13 | from svg2tikz.tikz_export import ( 14 | escape_texchars, 15 | copy_to_clipboard, 16 | return_arg_parser_doc, 17 | ) 18 | 19 | 20 | class TestUtilityFunctions(unittest.TestCase): 21 | """Test all utility functions from tikz_export""" 22 | 23 | def test_exscape_texchars(self): 24 | """Test escape texchars 25 | - Single char 26 | - Combination of chars 27 | """ 28 | special_tex_chars = [ 29 | ["$", r"\$"], 30 | ["\\", r"$\backslash$"], 31 | ["%", r"\%"], 32 | ["_", r"\_"], 33 | ["#", r"\#"], 34 | ["{", r"\{"], 35 | ["}", r"\}"], 36 | ["^", r"\^{}"], 37 | ["&", r"\&"], 38 | ["$#&{}", r"\$\#\&\{\}"], 39 | ] 40 | for symbols in special_tex_chars: 41 | self.assertEqual(symbols[1], escape_texchars(symbols[0])) 42 | 43 | @unittest.skip("cannot run in GH action") # pragma: no cover 44 | def test_copy_to_clipboard(self): 45 | """Test copy""" 46 | self.assertTrue(copy_to_clipboard(b"Test text")) 47 | 48 | def test_get_arg_parser(self): 49 | """Test getting the arg parser""" 50 | arg_parser_doc = return_arg_parser_doc() 51 | self.assertTrue(isinstance(arg_parser_doc, argparse.ArgumentParser)) 52 | -------------------------------------------------------------------------------- /tests/testdest/README.md: -------------------------------------------------------------------------------- 1 | Folder for temporary files during testing 2 | -------------------------------------------------------------------------------- /tests/testdest/convert_svg_output_file: -------------------------------------------------------------------------------- 1 | \path[draw=black,line width=0.254cm,->] (2.54, 3.175) -- (5.08, 3.175) -- (6.35, 1.905); 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/testdest/transform_noreversey.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=-\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=,line width=0.2cm] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 12 | 13 | 14 | 15 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,0.0,1.0,(0.0, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 16 | 17 | 18 | 19 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,-0.0875,1.0,(0.2034, 7.3338)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 20 | 21 | 22 | 23 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0257,0.0,0.0,0.4824,(-0.0558, 12.489)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 24 | 25 | 26 | 27 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0,0.0875,1.0,(3.5586, 0.0)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 28 | 29 | 30 | 31 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,0.0875,1.0,(3.5586, 3.5718)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 32 | 33 | 34 | 35 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,0.1736,-0.1736,0.9848,(4.1986, 7.1819)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 36 | 37 | 38 | 39 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.5,0.0,0.0,0.5,(4.8482, 12.448)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 40 | 41 | 42 | 43 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0,-0.0875,1.0,(7.7272, 0.0)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 44 | 45 | 46 | 47 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,0.0875,1.0,(7.3205, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 48 | 49 | 50 | 51 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,-0.1736,0.1736,0.9848,(7.1532, 7.9364)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 52 | 53 | 54 | 55 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.1,0.0,0.0,1.1,(7.3066, 11.0533)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 56 | 57 | 58 | 59 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,0.0,1.0,(11.2858, -0.1901)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 60 | 61 | 62 | 63 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,-0.0875,1.0,(11.4891, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 64 | 65 | 66 | 67 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.4824,0.0,0.0,1.0257,(12.4103, 7.4641)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 68 | 69 | 70 | 71 | \path[draw=black,line cap=,line width=0.2cm,shift={(11.7858, 10.7858)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 72 | 73 | 74 | 75 | \path[draw=black,line cap=,line width=0.2cm,xscale=1.5,yscale=0.5] (1.0186, 30.0) rectangle (3.3265, 32.3079); 76 | 77 | 78 | 79 | 80 | \end{tikzpicture} 81 | \end{document} 82 | -------------------------------------------------------------------------------- /tests/testfiles/R_letter_with_arc.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 35 | 37 | 41 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /tests/testfiles/R_letter_with_arc.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{c584528}{RGB}{88,69,40} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \path[fill=c584528,line width=0.0265cm] (1.139, 27.7421) -- (0.8996, 27.7421) -- (0.8996, 29.065) -- (1.412, 29.065)arc(269.0684:315.4369:0.1347 and -0.1347)arc(-46.43000000000001:0.8173:0.1311 and -0.1311) -- (1.5509, 28.4461)arc(-1.6533999999999764:58.4445:0.1287 and -0.1287)arc(-58.43090000000001:1.6398:0.1288 and -0.1288) -- (1.5509, 27.8781)arc(182.0888:115.7033:0.127 and -0.127) .. controls (1.6278, 27.7559) and (1.6304, 27.7528) .. (1.6304, 27.7497)arc(-8.094499999999982:98.4931:0.0067 and -0.0067) -- (1.459, 27.7421)arc(88.9159:135.3056:0.1339 and -0.1339)arc(133.7122:180.9811:0.1302 and -0.1302) -- (1.3211, 28.2335) -- (1.1391, 28.2335) -- cycle(1.139, 28.4413) -- (1.321, 28.4413) -- (1.321, 28.8288) -- (1.139, 28.8288) -- cycle; 13 | 14 | 15 | 16 | 17 | \end{tikzpicture} 18 | \end{document} 19 | -------------------------------------------------------------------------------- /tests/testfiles/arrows_marking.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 51 | 57 | 58 | 71 | 75 | 76 | 89 | 93 | 94 | 107 | 112 | 113 | 126 | 130 | 131 | 144 | 148 | 149 | 162 | 166 | 167 | 180 | 184 | 185 | 186 | 190 | 196 | 202 | 208 | 214 | 220 | 226 | 232 | 238 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /tests/testfiles/attribute_texmode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | \emph{emphasized} 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | Text with \ and _ 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 48 | 49 | 50 | 51 | 52 | 54 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | 65 | 66 | \frac{a}{b} 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /tests/testfiles/attribute_texmode.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{ceecbff}{RGB}{238,203,255} 8 | \definecolor{cbae1ff}{RGB}{186,225,255} 9 | 10 | 11 | \def \globalscale {1.000000} 12 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 13 | \path[fill=white] ; 14 | 15 | 16 | 17 | \path[draw=black,miter limit=10.0] (0.9033, 0.9033) -- (6.7141, 5.4208); 18 | 19 | 20 | 21 | \path[draw=black,fill=black,miter limit=10.0] (6.8236, 5.506) -- (6.7344, 5.3192) -- (6.7141, 5.4208) -- (6.6207, 5.4655) -- cycle; 22 | 23 | 24 | 25 | \path[fill=ceecbff] (0.5292, 0.5292) ellipse (0.5292cm and 0.5292cm); 26 | 27 | 28 | 29 | \begin{scope}[fill=black,anchor=south] 30 | \node[text=black,anchor=south] (emphtext) at (0.5159, 0.5159){\emph{emphasized}}; 31 | 32 | 33 | 34 | \end{scope} 35 | \path[fill=cbae1ff] (7.4083, 6.0854) ellipse (0.7938cm and 0.7938cm); 36 | 37 | 38 | 39 | \begin{scope}[shift={(-0.0132, 0.0132)}] 40 | \node[text=black,anchor=south] (regulartext) at (7.4083, 5.9796){Text with $\backslash$ and \_}; 41 | 42 | 43 | 44 | \end{scope} 45 | \path[draw=black,miter limit=10.0] (2.1167, 5.2917) -- (4.3656, 5.2917) -- (4.3656, 6.0854) -- (6.446, 6.0854); 46 | 47 | 48 | 49 | \path[draw=black,fill=black,miter limit=10.0] (6.585, 6.0854) -- (6.3997, 5.9928) -- (6.446, 6.0854) -- (6.3997, 6.178) -- cycle; 50 | 51 | 52 | 53 | \path[draw=black,miter limit=10.0] (1.2134, 4.9175) -- (1.2144, 2.9104) -- (0.5292, 2.9104) -- (0.5292, 1.2269); 54 | 55 | 56 | 57 | \path[draw=black,fill=black,miter limit=10.0] (0.5292, 1.088) -- (0.4366, 1.2732) -- (0.5292, 1.2269) -- (0.6218, 1.2732) -- cycle; 58 | 59 | 60 | 61 | \path[fill=ceecbff] (1.5875, 5.2917) ellipse (0.5292cm and 0.5292cm); 62 | 63 | 64 | 65 | \begin{scope}[fill=black,anchor=south] 66 | \node[text=black,anchor=south] (mathtext) at (1.5743, 5.2784){$\frac{a}{b}$}; 67 | 68 | 69 | 70 | \end{scope} 71 | 72 | \end{tikzpicture} 73 | \end{document} 74 | -------------------------------------------------------------------------------- /tests/testfiles/blocs_and_groups.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{grey}{RGB}{128,128,128} 8 | \definecolor{ce47f64}{RGB}{228,127,100} 9 | \definecolor{ceb5a55}{RGB}{235,90,85} 10 | \definecolor{c88bdfb}{RGB}{136,189,251} 11 | 12 | 13 | \def \globalscale {1.000000} 14 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 15 | \begin{scope}[cm={ 1.3333,-0.0,-0.0,-1.3333,(0.0, -36.301)}] 16 | \begin{scope}[cm={ 0.3225,-0.0,-0.0,0.3225,(5.3871, -49.2583)}] 17 | \begin{scope}[shift={(-11.1595, -11.4859)}] 18 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (8.5647, 14.9359) -- (8.5647, 16.3249) -- (17.0205, 16.3249) -- (17.0205, 14.9359) -- cycle; 19 | 20 | 21 | 22 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (8.5647, 19.1313) -- (8.5647, 20.5202) -- (17.0205, 20.5202) -- (17.0205, 19.1313) -- cycle; 23 | 24 | 25 | 26 | \path[draw=black,fill=ce47f64,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (8.5505, 16.3391) -- (8.5505, 17.7281) -- (14.1784, 17.7281) -- (14.1784, 16.3391) -- cycle; 27 | 28 | 29 | 30 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (9.9645, 16.325) -- (9.9645, 17.7423); 31 | 32 | 33 | 34 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (12.7926, 16.325) -- (12.7926, 17.7423); 35 | 36 | 37 | 38 | \path[draw=black,fill=ce47f64,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (14.1784, 16.3391) -- (14.1784, 17.7281) -- (19.8062, 17.7281) -- (19.8062, 16.3391) -- cycle; 39 | 40 | 41 | 42 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (15.5924, 16.3249) -- (15.5924, 17.7423); 43 | 44 | 45 | 46 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (18.4205, 16.3249) -- (18.4205, 17.7423); 47 | 48 | 49 | 50 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (11.216, 17.7423) -- (11.216, 19.1313) -- (19.6718, 19.1313) -- (19.6718, 17.7423) -- cycle; 51 | 52 | 53 | 54 | \path[draw=black,fill=ceb5a55,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (16.5185, 17.7423) -- (16.5185, 19.1313) -- (17.5508, 19.1313) -- (17.5508, 17.7423) -- cycle; 55 | 56 | 57 | 58 | \path[draw=black,fill=c88bdfb,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (17.5508, 17.7423) -- (17.5508, 19.1313) -- (18.583, 19.1313) -- (18.583, 17.7423) -- cycle; 59 | 60 | 61 | 62 | \path[draw=black,fill=ceb5a55,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (14.341, 17.7423) -- (14.341, 19.1313) -- (13.3087, 19.1313) -- (13.3087, 17.7423) -- cycle; 63 | 64 | 65 | 66 | \path[draw=black,fill=c88bdfb,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (13.3087, 17.7423) -- (13.3087, 19.1313) -- (12.2764, 19.1313) -- (12.2764, 17.7423) -- cycle; 67 | 68 | 69 | 70 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (0.1129, 16.3002) -- (0.1129, 17.6892) -- (8.5689, 17.6892) -- (8.5689, 16.3002) -- cycle; 71 | 72 | 73 | 74 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (0.1129, 14.9112) -- (0.1129, 16.3002) -- (8.5689, 16.3002) -- (8.5689, 14.9112) -- cycle; 75 | 76 | 77 | 78 | \path[draw=black,fill=ce47f64,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (0.0988, 17.7033) -- (0.0988, 19.0923) -- (5.7266, 19.0923) -- (5.7266, 17.7033) -- cycle; 79 | 80 | 81 | 82 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (1.5129, 17.6892) -- (1.5129, 19.1065); 83 | 84 | 85 | 86 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (4.3409, 17.6892) -- (4.3409, 19.1065); 87 | 88 | 89 | 90 | \path[draw=black,fill=ce47f64,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (5.5429, 17.7033) -- (5.5429, 19.0923) -- (11.1707, 19.0923) -- (11.1707, 17.7033) -- cycle; 91 | 92 | 93 | 94 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (6.9569, 17.6892) -- (6.9569, 19.1065); 95 | 96 | 97 | 98 | \path[draw=black,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0,dash pattern=on 0.0482cm off 0.0482cm] (9.785, 17.6892) -- (9.785, 19.1065); 99 | 100 | 101 | 102 | \path[draw=black,fill=grey,nonzero rule,line cap=butt,line join=miter,line width=0.0482cm,miter limit=4.0] (0.1087, 19.1272) -- (0.1087, 20.5162) -- (8.5646, 20.5162) -- (8.5646, 19.1272) -- cycle; 103 | 104 | 105 | 106 | \end{scope} 107 | \end{scope} 108 | \end{scope} 109 | 110 | \end{tikzpicture} 111 | \end{document} 112 | -------------------------------------------------------------------------------- /tests/testfiles/circle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /tests/testfiles/circle.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=,line width=0.2cm] (2.7319, 26.8727) circle (2.2948cm); 12 | 13 | 14 | 15 | 16 | \end{tikzpicture} 17 | \end{document} 18 | -------------------------------------------------------------------------------- /tests/testfiles/circle_verbose.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /tests/testfiles/circle_verbose.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \begin{scope}[]%% layer1 12 | %path1573 13 | \path[draw=black,line cap=,line width=0.2cm] (2.7319, 26.8727) circle (2.2948cm); 14 | 15 | 16 | 17 | \end{scope} 18 | 19 | \end{tikzpicture} 20 | \end{document} 21 | -------------------------------------------------------------------------------- /tests/testfiles/crop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /tests/testfiles/crop.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \usepackage[active,tightpage]{preview} 7 | \PreviewEnvironment{tikzpicture} 8 | 9 | \begin{document} 10 | 11 | 12 | \def \globalscale {1.000000} 13 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 14 | \path[draw=black,line cap=,line width=0.2cm] (0.7985, 28.9408) rectangle (5.0753, 27.1111); 15 | 16 | 17 | 18 | 19 | \end{tikzpicture} 20 | \end{document} 21 | -------------------------------------------------------------------------------- /tests/testfiles/curves.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 26 | 27 | 47 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /tests/testfiles/curves.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=butt,line join=miter,line width=0.0265cm] (0.2646, 3.8353) .. controls (1.7639, 5.07) and (3.2632, 5.07) .. (4.7625, 3.8353); 12 | 13 | 14 | 15 | \path[draw=black,line cap=butt,line join=miter,line width=0.0265cm] (0.3071, 3.0866).. controls (1.0426, 3.3591) and (1.7781, 3.6316) .. (2.5191, 3.6606).. controls (3.2601, 3.6895) and (4.0185, 3.4715) .. (4.7709, 3.2552); 16 | 17 | 18 | 19 | 20 | \end{tikzpicture} 21 | \end{document} 22 | -------------------------------------------------------------------------------- /tests/testfiles/display_none_in_group.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 50 | 59 | 62 | 69 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /tests/testfiles/display_none_in_group.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=red,fill=red,opacity=0.7,draw opacity=0.9925,line width=0.1502cm,rounded corners=1.5536cm] (5.0181, 25.6783) rectangle (10.8699, 21.1104); 12 | 13 | 14 | 15 | \path[rounded corners=1.2425cm] (6.8337, 23.2868) rectangle (12.016, 20.8019); 16 | 17 | 18 | 19 | % \begin{scope}[] 20 | % \path[draw=red,fill=red,opacity=0.7,draw opacity=0.9925,line width=0.1502cm] (8.6954, 19.6182) ellipse (1.6161cm and 1.6625cm); 21 | % 22 | % 23 | % 24 | % \path[draw=red,fill=red,opacity=0.7,draw opacity=0.9925,line width=0.1502cm] (10.7062, 19.9881) ellipse (1.7713cm and 1.0947cm); 25 | % 26 | % 27 | % 28 | % \end{scope} 29 | 30 | \end{tikzpicture} 31 | \end{document} 32 | -------------------------------------------------------------------------------- /tests/testfiles/ellipse.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 37 | 39 | 43 | 50 | 57 | 61 | 65 | 69 | 73 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /tests/testfiles/ellipse.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,fill opacity=0.1632,line width=0.1cm,miter limit=4.0] (3.0, 27.7) ellipse (2.0cm and 1.0cm); 12 | 13 | 14 | 15 | \path[draw=black,fill opacity=0.1632,line width=0.1cm,miter limit=4.0] (6.5, 27.7) ellipse (1.0cm and 2.0cm); 16 | 17 | 18 | 19 | \path[draw=black,line width=0.1cm,miter limit=4.0] (2.0352, 26.0216)arc(208.444:180.0576:3.7795 and -7.5591)arc(179.944:151.5747:3.7795 and -7.5591)arc(71.9242:0.033:7.5591 and -3.7795)arc(359.9981:288.0805:7.5591 and -3.7795) -- cycle; 20 | 21 | 22 | 23 | \path[draw=black,line width=0.1cm,miter limit=4.0] (4.8958, 28.0492){[rotate=-10.0] arc(276.7889:226.911:3.7795 and -7.5591)}; 24 | 25 | 26 | 27 | \path[draw=black,line width=0.1cm,miter limit=4.0] (4.7046, 26.4058)arc(258.8106:329.7054:3.0 and -3.0); 28 | 29 | 30 | 31 | \path[draw=black,line width=0.1cm,miter limit=4.0] (0.3, 29.4)arc(270.0:90.0:0.2 and -0.4) -- cycle; 32 | 33 | 34 | 35 | \path[draw=black,line width=0.1cm,miter limit=4.0] (0.6, 29.4)arc(0.0:0.0:0.2 and -0.2) -- cycle; 36 | 37 | 38 | 39 | 40 | \end{tikzpicture} 41 | \end{document} 42 | -------------------------------------------------------------------------------- /tests/testfiles/ellipse_noreversey.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=-\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,fill opacity=0.1632,line width=0.1cm,miter limit=4.0] (3.0, 2.0) ellipse (2.0cm and 1.0cm); 12 | 13 | 14 | 15 | \path[draw=black,fill opacity=0.1632,line width=0.1cm,miter limit=4.0] (6.5, 2.0) ellipse (1.0cm and 2.0cm); 16 | 17 | 18 | 19 | \path[draw=black,line width=0.1cm,miter limit=4.0] (2.0352, 3.6784)arc(208.444:180.0576:3.7795 and 7.5591)arc(179.944:151.5747:3.7795 and 7.5591)arc(71.9242:0.033:7.5591 and 3.7795)arc(359.9981:288.0805:7.5591 and 3.7795) -- cycle; 20 | 21 | 22 | 23 | \path[draw=black,line width=0.1cm,miter limit=4.0] (4.8958, 1.6508){[rotate=10.0] arc(276.7889:226.911:3.7795 and 7.5591)}; 24 | 25 | 26 | 27 | \path[draw=black,line width=0.1cm,miter limit=4.0] (4.7046, 3.2942)arc(258.8106:329.7054:3.0); 28 | 29 | 30 | 31 | \path[draw=black,line width=0.1cm,miter limit=4.0] (0.3, 0.3)arc(270.0:90.0:0.2 and 0.4) -- cycle; 32 | 33 | 34 | 35 | \path[draw=black,line width=0.1cm,miter limit=4.0] (0.6, 0.3)arc(0.0:0.0:0.2) -- cycle; 36 | 37 | 38 | 39 | 40 | \end{tikzpicture} 41 | \end{document} 42 | -------------------------------------------------------------------------------- /tests/testfiles/image.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | % Image image2668 not included. Base64 still not supported; 12 | 13 | 14 | 15 | \node[anchor=north west,inner sep=0, scale=\globalscale] (image2869) at (5.1699, 23.2052) {\includegraphics[width=8.2285cm,height=2.3813cm]{../other/inkscape_logo.png}}; 16 | 17 | 18 | 19 | % Image image2931 not included. Base64 still not supported; 20 | 21 | 22 | 23 | 24 | \end{tikzpicture} 25 | \end{document} 26 | -------------------------------------------------------------------------------- /tests/testfiles/line.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 36 | 46 | 47 | -------------------------------------------------------------------------------- /tests/testfiles/line.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{cdddddd}{RGB}{221,221,221} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \path[draw=cdddddd,line width=0.0529cm,miter limit=10.0] (0.0, 12.8058) -- (10.5833, 2.2225); 13 | 14 | 15 | 16 | 17 | \end{tikzpicture} 18 | \end{document} 19 | -------------------------------------------------------------------------------- /tests/testfiles/lines_style.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 10.9077) -- (7.7347, 10.9077); 12 | 13 | 14 | 15 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm] (0.8078, 0.0989) -- (0.8078, -0.882) -- (2.0932, -0.882); 16 | 17 | 18 | 19 | \path[draw=black,line cap=,line join=bevel,line width=0.1cm] (6.336, 0.0989) -- (6.336, -0.882) -- (7.6214, -0.882); 20 | 21 | 22 | 23 | \path[draw=black,line cap=,line join=miter,line width=0.1cm,miter limit=4.0] (4.4932, 0.0989) -- (4.4932, -0.882) -- (5.7786, -0.882); 24 | 25 | 26 | 27 | \path[draw=black,line cap=round,line join=round,line width=0.1cm] (2.6505, 0.0989) -- (2.6505, -0.882) -- (3.9359, -0.882); 28 | 29 | 30 | 31 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 10.2689) -- (7.7347, 10.2689); 32 | 33 | 34 | 35 | \path[draw=black,line cap=butt,line join=miter,line width=0.05cm] (0.7578, 9.6302) -- (7.7347, 9.6302); 36 | 37 | 38 | 39 | \path[draw=black,line cap=butt,line join=miter,line width=0.2cm] (0.7578, 8.9914) -- (7.7347, 8.9914); 40 | 41 | 42 | 43 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,dash pattern=on 0.1cm off 0.1cm] (0.7578, 8.3527) -- (7.7347, 8.3527); 44 | 45 | 46 | 47 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,dash pattern=on 0.2cm off 0.1cm] (0.7578, 7.7139) -- (7.7347, 7.7139); 48 | 49 | 50 | 51 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,dash pattern=on 0.4cm off 0.2cm on 0.1cm off 0.2cm] (0.7578, 7.0752) -- (7.7347, 7.0752); 52 | 53 | 54 | 55 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,stealth-] (0.7578, 6.4364) -- (7.7347, 6.4364); 56 | 57 | 58 | 59 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,-|] (0.7578, 5.7977) -- (7.7347, 5.7977); 60 | 61 | 62 | 63 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,latex-] (0.7578, 5.1589) -- (7.7347, 5.1589); 64 | 65 | 66 | 67 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,-latex] (0.7578, 4.5202) -- (7.7347, 4.5202); 68 | 69 | 70 | 71 | \path[draw=black,line cap=butt,line join=miter,line width=0.1cm,|-latex] (0.7578, 3.8814) -- (7.7347, 3.8814); 72 | 73 | 74 | 75 | \path[draw=black,line cap=round,line join=miter,line width=0.1cm] (0.7578, 3.2427) -- (7.7347, 3.2427); 76 | 77 | 78 | 79 | \path[draw=black,line cap=,line join=miter,line width=0.1cm] (0.7578, 2.6039) -- (7.7347, 2.6039); 80 | 81 | 82 | 83 | \path[draw=red,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 1.9652) -- (7.7347, 1.9652); 84 | 85 | 86 | 87 | \path[draw=blue,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 1.3264) -- (7.7347, 1.3264); 88 | 89 | 90 | 91 | \path[draw=yellow,line cap=butt,line join=miter,line width=0.1cm] (0.7578, 0.6877) -- (7.7347, 0.6877); 92 | 93 | 94 | 95 | 96 | \end{tikzpicture} 97 | \end{document} 98 | -------------------------------------------------------------------------------- /tests/testfiles/nodes_and_transform.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 36 | 41 | 46 | 49 | 51 | 57 | 60 | 62 | 66 | 74 | 82 | 90 | 98 | 106 | 114 | 122 | 130 | 138 | 146 | 147 | 151 | Glabron 159 | Manchuria 167 | No. 457 175 | No. 462 183 | No. 475 191 | Peatland 199 | Svansota 207 | Trebi 215 | Velvet 223 | Wisconsin No. 38 231 | 232 | 236 | 244 | 245 | 249 | variety 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | -------------------------------------------------------------------------------- /tests/testfiles/nodes_and_transform.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{c888888}{RGB}{136,136,136} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \begin{scope}[miter limit=10.0,shift={(5.9796, -0.2646)}] 13 | \begin{scope}[miter limit=10.0] 14 | \begin{scope}[miter limit=10.0] 15 | \begin{scope}[miter limit=10.0] 16 | \begin{scope}[miter limit=10.0] 17 | \begin{scope}[miter limit=10.0,shift={(0.0265, -0.0265)}] 18 | \begin{scope}[miter limit=10.0] 19 | \begin{scope}[miter limit=10.0] 20 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -0.5292)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 21 | 22 | 23 | 24 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -1.5875)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 25 | 26 | 27 | 28 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -2.6458)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 29 | 30 | 31 | 32 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -3.7042)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 33 | 34 | 35 | 36 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -4.7625)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 37 | 38 | 39 | 40 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -5.8208)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 41 | 42 | 43 | 44 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -6.8792)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 45 | 46 | 47 | 48 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -7.9375)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 49 | 50 | 51 | 52 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -8.9958)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 53 | 54 | 55 | 56 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0,shift={(0.0, -10.0542)}] (0.0, 12.8058) -- (-0.2646, 12.8058); 57 | 58 | 59 | 60 | \end{scope} 61 | \begin{scope}[miter limit=10.0] 62 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -0.6615)}] (text34) at (0.0, 12.8058){Glabron}; 63 | 64 | 65 | 66 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -1.7198)}] (text35) at (0.0, 12.8058){Manchuria}; 67 | 68 | 69 | 70 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -2.7781)}] (text36) at (0.0, 12.8058){No. 457}; 71 | 72 | 73 | 74 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -3.8365)}] (text37) at (0.0, 12.8058){No. 462}; 75 | 76 | 77 | 78 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -4.8948)}] (text38) at (0.0, 12.8058){No. 475}; 79 | 80 | 81 | 82 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -5.9531)}] (text39) at (0.0, 12.8058){Peatland}; 83 | 84 | 85 | 86 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -7.0115)}] (text40) at (0.0, 12.8058){Svansota}; 87 | 88 | 89 | 90 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -8.0698)}] (text41) at (0.0, 12.8058){Trebi}; 91 | 92 | 93 | 94 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -9.1281)}] (text42) at (0.0, 12.8058){Velvet}; 95 | 96 | 97 | 98 | \node[text=black,anchor=south east,miter limit=10.0,shift={(-0.3704, -10.1865)}] (text43) at (0.0, 12.8058){Wisconsin No. 38}; 99 | 100 | 101 | 102 | \end{scope} 103 | \begin{scope}[miter limit=10.0] 104 | \path[draw=c888888,line width=0.0529cm,miter limit=10.0] (0.0, 12.8058) -- (0.0, 2.2225); 105 | 106 | 107 | 108 | \end{scope} 109 | \begin{scope}[miter limit=10.0] 110 | \node[text=black,anchor=south,miter limit=10.0,cm={ 0.0,1.0,-1.0,0.0,(-5.2211, -3.175)}] (text44) at (0.0, 12.8058){variety}; 111 | 112 | 113 | 114 | \end{scope} 115 | \end{scope} 116 | \end{scope} 117 | \end{scope} 118 | \end{scope} 119 | \end{scope} 120 | \end{scope} 121 | \end{scope} 122 | 123 | \end{tikzpicture} 124 | \end{document} 125 | -------------------------------------------------------------------------------- /tests/testfiles/pentagone_round_corner.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tests/testfiles/pentagone_round_corner.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[fill] (6.4182, 11.8297).. controls (-3.346, 16.7118) and (3.1158, 4.2643) .. (4.7416, 15.0593).. controls (6.3675, 25.8543) and (-3.4739, 15.8623) .. (7.2951, 17.6519).. controls (18.0642, 19.4414) and (5.5201, 25.7135) .. (10.5499, 16.0245).. controls (15.5796, 6.3355) and (17.6684, 20.2038) .. (10.0079, 12.4262).. controls (2.3474, 4.6485) and (16.1824, 6.9476) .. (6.4182, 11.8297) -- cycle; 12 | 13 | 14 | 15 | 16 | \end{tikzpicture} 17 | \end{document} 18 | -------------------------------------------------------------------------------- /tests/testfiles/polylines_polygones.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 49 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /tests/testfiles/polylines_polygones.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,fill,line join=round,line width=0.3cm,cm={ 4.7668,-0.0,-0.0,4.7668,(-18.2373, -115.945)}] (5.1, 29.7) -- (4.6, 30.0) -- (4.6, 29.4) -- (5.1, 29.7)-- cycle;; 12 | 13 | 14 | 15 | \path[draw=black,line join=round,line width=0.3cm,cm={ 4.7668,-0.0,-0.0,4.7668,(-12.0541, -115.945)}] (5.1, 29.7) -- (4.6, 30.0) -- (4.6, 29.4);; 16 | 17 | 18 | 19 | 20 | \end{tikzpicture} 21 | \end{document} 22 | -------------------------------------------------------------------------------- /tests/testfiles/rectangle.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 57 | 68 | 79 | 90 | 105 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /tests/testfiles/rectangle.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{cc2a2f2}{RGB}{194,162,242} 8 | \definecolor{ccdf4c8}{RGB}{205,244,200} 9 | 10 | 11 | \def \globalscale {1.000000} 12 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 13 | \path[draw=black,line cap=,line width=0.2cm] (0.7985, 28.9408) rectangle (5.0753, 27.1111); 14 | 15 | 16 | 17 | \path[draw=black,line cap=,line width=0.2cm,rounded corners=0.6627cm] (0.7985, 25.8962) rectangle (5.0753, 24.0665); 18 | 19 | 20 | 21 | \path[draw=black,line cap=,line width=0.2cm,rounded corners=0.644cm] (7.5137, 28.9408) rectangle (11.7905, 27.1111); 22 | 23 | 24 | 25 | \path[draw=cc2a2f2,fill=ccdf4c8,line cap=,line width=0.2cm] (7.5137, 25.8962) rectangle (11.7905, 24.0665); 26 | 27 | 28 | 29 | \path[draw=black,line cap=,line width=0.2cm] ; 30 | 31 | 32 | 33 | 34 | \end{tikzpicture} 35 | \end{document} 36 | -------------------------------------------------------------------------------- /tests/testfiles/rectangle_wrap.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 36 | 38 | 42 | 57 | 68 | 79 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /tests/testfiles/rectangle_wrap.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{cc2a2f2}{RGB}{194,162,242} 8 | \definecolor{ccdf4c8}{RGB}{205,244,200} 9 | 10 | 11 | \def \globalscale {1.000000} 12 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 13 | \path[draw=black,line cap=,line width=0.2cm] (0.7985, 28.9408) rectangle 14 | (5.0753, 27.1111); 15 | 16 | 17 | 18 | \path[draw=black,line cap=,line width=0.2cm,rounded corners=0.6627cm] (0.7985, 19 | 25.8962) rectangle (5.0753, 24.0665); 20 | 21 | 22 | 23 | \path[draw=black,line cap=,line width=0.2cm,rounded corners=0.644cm] (7.5137, 24 | 28.9408) rectangle (11.7905, 27.1111); 25 | 26 | 27 | 28 | \path[draw=cc2a2f2,fill=ccdf4c8,line cap=,line width=0.2cm] (7.5137, 25.8962) 29 | rectangle (11.7905, 24.0665); 30 | 31 | 32 | 33 | 34 | \end{tikzpicture} 35 | \end{document} 36 | -------------------------------------------------------------------------------- /tests/testfiles/s_command_letter.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 31 | 33 | 35 | 36 | 38 | 40 | 42 | 47 | 48 | 49 | 51 | 53 | 55 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /tests/testfiles/s_command_letter.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{cff5555}{RGB}{255,85,85} 8 | \definecolor{c003cff}{RGB}{0,60,255} 9 | 10 | 11 | \def \globalscale {1.000000} 12 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 13 | \path[fill=cff5555] (6.6514, -0.2902).. controls (6.6119, -0.2902) and (6.5775, -0.2762) .. (6.5487, -0.2479).. controls (6.5199, -0.2196) and (6.5053, -0.1852) .. (6.5053, -0.1442).. controls (6.5053, -0.1032) and (6.5199, -0.0709) .. (6.5487, -0.0426).. controls (6.5775, -0.0143) and (6.6119, 0.0) .. (6.6514, 0.0).. controls (6.6908, 0.0) and (6.7265, -0.0143) .. (6.754, -0.0426).. controls (6.7815, -0.0709) and (6.7956, -0.1048) .. (6.7956, -0.1442).. controls (6.7956, -0.1836) and (6.7818, -0.2196) .. (6.754, -0.2479).. controls (6.7265, -0.2762) and (6.6921, -0.2902) .. (6.6514, -0.2902) -- cycle(6.5429, -1.4923) -- (6.5429, -0.5054) -- (6.7598, -0.5054) -- (6.7598, -1.4923) -- cycle; 14 | 15 | 16 | 17 | \path[fill=c003cff] (6.6514, -0.2902).. controls (6.6119, -0.2902) and (6.5775, -0.2762) .. (6.5487, -0.2479).. controls (6.5199, -0.2196) and (6.5053, -0.1852) .. (6.5053, -0.1442).. controls (6.5053, -0.1032) and (6.5199, -0.0709) .. (6.5487, -0.0426).. controls (6.5775, -0.0143) and (6.6119, -0.0) .. (6.6514, -0.0).. controls (6.6908, -0.0) and (6.7265, -0.0143) .. (6.754, -0.0426).. controls (6.7815, -0.0709) and (6.7956, -0.1048) .. (6.7956, -0.1442).. controls (6.7956, -0.1836) and (6.7818, -0.2196) .. (6.754, -0.2479).. controls (6.7265, -0.2762) and (6.6921, -0.2902) .. (6.6514, -0.2902) -- cycle; 18 | 19 | 20 | 21 | 22 | \end{tikzpicture} 23 | \end{document} 24 | -------------------------------------------------------------------------------- /tests/testfiles/s_command_no_previous_bezier.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 35 | 37 | 51 | 52 | 56 | 57 | -------------------------------------------------------------------------------- /tests/testfiles/s_command_no_previous_bezier.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{ceeece2}{RGB}{238,236,226} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \path[fill=ceeece2] (5.3796, 7.0696).. controls (5.3796, 6.9768) and (4.6487, 7.5767) .. (4.6396, 7.7775).. controls (4.6304, 7.9783) and (4.6396, 13.7737) .. (4.6396, 13.7737) -- (8.1686, 13.7737).. controls (8.1686, 13.7737) and (8.1686, 7.1628) .. (8.1686, 7.0696) -- cycle; 13 | 14 | 15 | 16 | 17 | \end{tikzpicture} 18 | \end{document} 19 | -------------------------------------------------------------------------------- /tests/testfiles/switch_simple.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 36 | 43 | 49 | 52 | vrai 1 59 | vrai 2 66 | 67 | 73 | Rotated 80 | 81 | 86 | 88 | Rotated 95 | 96 | 97 | 100 | Rotated 107 | 108 | 109 | -------------------------------------------------------------------------------- /tests/testfiles/switch_simple_noverbose.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,miter limit=10.0] (3.2015, 5.5298) -- (1.2171, 5.5298) -- (1.2171, 4.3754); 12 | 13 | 14 | 15 | \path[draw=black,fill,miter limit=10.0] (1.2171, 4.2365) -- (1.1245, 4.4217) -- (1.2171, 4.3754) -- (1.3097, 4.4217) -- cycle; 16 | 17 | 18 | 19 | \begin{scope}[shift={(-0.0132, 0.189)}] 20 | \node[anchor=south] (text2) at (2.249, 5.3975){vrai 1}; 21 | 22 | 23 | 24 | \node[anchor=south] (text2-3) at (2.221, 4.9919){vrai 2}; 25 | 26 | 27 | 28 | \end{scope} 29 | \begin{scope}[opacity=0.5,cm={ 0.0,1.0,-1.0,0.0,(10.1208, 3.4369)},transparency group] 30 | \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 31 | 32 | 33 | 34 | \end{scope} 35 | \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 36 | 37 | 38 | 39 | % \begin{scope}[] 40 | % \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 41 | % 42 | % 43 | % 44 | % \end{scope} 45 | 46 | \end{tikzpicture} 47 | \end{document} 48 | -------------------------------------------------------------------------------- /tests/testfiles/switch_simple_verbose.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | %path1 12 | \path[draw=black,miter limit=10.0] (3.2015, 5.5298) -- (1.2171, 5.5298) -- (1.2171, 4.3754); 13 | 14 | 15 | 16 | %path2 17 | \path[draw=black,fill,miter limit=10.0] (1.2171, 4.2365) -- (1.1245, 4.4217) -- (1.2171, 4.3754) -- (1.3097, 4.4217) -- cycle; 18 | 19 | 20 | 21 | \begin{scope}[shift={(-0.0132, 0.189)}]%% switch2 22 | %text2 23 | \node[anchor=south] (text2) at (2.249, 5.3975){vrai 1}; 24 | 25 | 26 | 27 | %text2-3 28 | \node[anchor=south] (text2-3) at (2.221, 4.9919){vrai 2}; 29 | 30 | 31 | 32 | \end{scope} 33 | \begin{scope}[opacity=0.5,cm={ 0.0,1.0,-1.0,0.0,(10.1208, 3.4369)},transparency group]%% switch2-6 34 | %text2-7 35 | \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 36 | 37 | 38 | 39 | \end{scope} 40 | \begin{scope}[]%% switch2-6 41 | %text2-7 42 | \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 43 | 44 | 45 | 46 | \end{scope} 47 | % \begin{scope}[]%% switch2-6 48 | % %text2-7 49 | % \node[anchor=south] (text2-7) at (2.249, 5.3975){Rotated}; 50 | % 51 | % 52 | % 53 | % \end{scope} 54 | 55 | \end{tikzpicture} 56 | \end{document} 57 | -------------------------------------------------------------------------------- /tests/testfiles/symbol_and_use.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 34 | 35 | 40 | 45 | 46 | 47 | 52 | 53 | 59 | 65 | 71 | 77 | 83 | 84 | -------------------------------------------------------------------------------- /tests/testfiles/symbol_and_use.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{pink}{RGB}{255,192,203} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \path[draw=pink] (0.0, -0.2646) -- (2.1167, -0.2646)(0.2646, 0.0) -- (0.2646, -0.5292)(0.6615, 0.0) -- (0.6615, -0.5292)(1.0583, 0.0) -- (1.0583, -0.5292)(1.4552, 0.0) -- (1.4552, -0.5292)(1.8521, 0.0) -- (1.8521, -0.5292); 13 | 14 | 15 | 16 | \begin{scope}[shift={(0.1323, -0.1323)}] 17 | \path[fill] (0.0265, -0.0265) circle (0.0265cm); 18 | 19 | 20 | 21 | \end{scope} 22 | \begin{scope}[opacity=0.8,shift={(0.5292, -0.1323)},transparency group] 23 | \path[fill] (0.0265, -0.0265) circle (0.0265cm); 24 | 25 | 26 | 27 | \end{scope} 28 | \begin{scope}[opacity=0.6,shift={(0.926, -0.1323)},transparency group] 29 | \path[fill] (0.0265, -0.0265) circle (0.0265cm); 30 | 31 | 32 | 33 | \end{scope} 34 | \begin{scope}[opacity=0.4,shift={(1.3229, -0.1323)},transparency group] 35 | \path[fill] (0.0265, -0.0265) circle (0.0265cm); 36 | 37 | 38 | 39 | \end{scope} 40 | \begin{scope}[opacity=0.2,shift={(1.7198, -0.1323)},transparency group] 41 | \path[fill] (0.0265, -0.0265) circle (0.0265cm); 42 | 43 | 44 | 45 | \end{scope} 46 | 47 | \end{tikzpicture} 48 | \end{document} 49 | -------------------------------------------------------------------------------- /tests/testfiles/text.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 38 | 45 | 52 | 59 | 66 | 73 | 74 | 76 | 80 | Normal Text 91 | Rotated text 103 | Start Text 115 | Middle Text 127 | End Text 139 | 140 | 141 | -------------------------------------------------------------------------------- /tests/testfiles/text.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \node[line width=0.0265cm,anchor=south west] (text3) at (1.0, 28.7){Normal Text}; 12 | 13 | 14 | 15 | \node[line width=0.0265cm,rotate=25.9218,anchor=south west] (text4) at (1.0, 28.7){Rotated text}; 16 | 17 | 18 | 19 | \node[anchor=south west,line width=0.0265cm] (text5) at (1.0, 28.2){Start Text}; 20 | 21 | 22 | 23 | \node[anchor=south,line width=0.0265cm] (text6) at (1.0, 27.7){Middle Text}; 24 | 25 | 26 | 27 | \node[anchor=south east,line width=0.0265cm] (text7) at (1.0, 27.2){End Text}; 28 | 29 | 30 | 31 | 32 | \end{tikzpicture} 33 | \end{document} 34 | -------------------------------------------------------------------------------- /tests/testfiles/text_fill_color.svg: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 36 | Default 43 | Red 51 | Green 59 | Blue 67 | Black 75 | 76 | -------------------------------------------------------------------------------- /tests/testfiles/text_fill_color.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | \definecolor{lime}{RGB}{0,255,0} 8 | 9 | 10 | \def \globalscale {1.000000} 11 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 12 | \node[anchor=south] (text2) at (3.385, 6.5697){Default}; 13 | 14 | 15 | 16 | \node[text=red,anchor=south] (text2-3) at (3.385, 6.2094){Red}; 17 | 18 | 19 | 20 | \node[text=lime,anchor=south] (text2-6) at (3.385, 5.8491){Green}; 21 | 22 | 23 | 24 | \node[text=blue,anchor=south] (text2-3-7) at (3.385, 5.4889){Blue}; 25 | 26 | 27 | 28 | \node[text=black,anchor=south] (text2-5) at (3.3992, 5.1286){Black}; 29 | 30 | 31 | 32 | 33 | \end{tikzpicture} 34 | \end{document} 35 | -------------------------------------------------------------------------------- /tests/testfiles/text_noreversey.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=-\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \node[line width=0.0265cm,anchor=south west] (text3) at (1.0, -1.0){Normal Text}; 12 | 13 | 14 | 15 | \node[line width=0.0265cm,rotate=25.9218,anchor=south west] (text4) at (1.0, -1.0){Rotated text}; 16 | 17 | 18 | 19 | \node[anchor=south west,line width=0.0265cm] (text5) at (1.0, -1.5){Start Text}; 20 | 21 | 22 | 23 | \node[anchor=south,line width=0.0265cm] (text6) at (1.0, -2.0){Middle Text}; 24 | 25 | 26 | 27 | \node[anchor=south east,line width=0.0265cm] (text7) at (1.0, -2.5){End Text}; 28 | 29 | 30 | 31 | 32 | \end{tikzpicture} 33 | \end{document} 34 | -------------------------------------------------------------------------------- /tests/testfiles/transform.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 37 | 39 | 43 | 56 | 63 | 70 | 77 | 84 | 91 | 98 | 105 | 112 | 120 | 127 | 134 | 141 | 148 | 155 | 162 | 176 | 177 | 178 | -------------------------------------------------------------------------------- /tests/testfiles/transform.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=,line width=0.2cm] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 12 | 13 | 14 | 15 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,-0.0,1.0,(0.0, -3.952)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 16 | 17 | 18 | 19 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,0.0875,1.0,(-2.3954, -7.3338)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 20 | 21 | 22 | 23 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0257,-0.0,-0.0,0.4824,(-0.0558, 2.8837)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 24 | 25 | 26 | 27 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0,-0.0875,1.0,(6.1573, 0.0)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 28 | 29 | 30 | 31 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,-0.0875,1.0,(6.1573, -3.5718)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 32 | 33 | 34 | 35 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,-0.1736,0.1736,0.9848,(-0.9573, -6.7305)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 36 | 37 | 38 | 39 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.5,-0.0,-0.0,0.5,(4.8482, 2.402)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 40 | 41 | 42 | 43 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0,0.0875,1.0,(5.1285, 0.0)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 44 | 45 | 46 | 47 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,-0.0875,1.0,(9.9192, -3.952)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 48 | 49 | 50 | 51 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,0.1736,-0.1736,0.9848,(12.3091, -7.485)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 52 | 53 | 54 | 55 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.1,-0.0,-0.0,1.1,(7.3066, -14.0233)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 56 | 57 | 58 | 59 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,-0.0,1.0,(11.2858, 0.1901)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 60 | 61 | 62 | 63 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,0.0875,1.0,(8.8904, -3.952)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 64 | 65 | 66 | 67 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.4824,-0.0,-0.0,1.0257,(12.4103, -8.2274)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 68 | 69 | 70 | 71 | \path[draw=black,line cap=,line width=0.2cm,shift={(11.7858, -10.7858)}] (1.0186, 28.5295) rectangle (3.3265, 26.2215); 72 | 73 | 74 | 75 | \path[draw=black,line cap=,line width=0.2cm,shift={(0,14.85)},xscale=1.5,yscale=0.5] (1.0186, -0.3) rectangle (3.3265, -2.6079); 76 | 77 | 78 | 79 | 80 | \end{tikzpicture} 81 | \end{document} 82 | -------------------------------------------------------------------------------- /tests/testfiles/transform_noreversey.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | \usepackage[utf8]{inputenc} 4 | \usepackage{tikz} 5 | 6 | \begin{document} 7 | 8 | 9 | \def \globalscale {1.000000} 10 | \begin{tikzpicture}[y=1cm, x=1cm, yscale=-\globalscale,xscale=\globalscale, every node/.append style={scale=\globalscale}, inner sep=0pt, outer sep=0pt] 11 | \path[draw=black,line cap=,line width=0.2cm] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 12 | 13 | 14 | 15 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,0.0,1.0,(0.0, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 16 | 17 | 18 | 19 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,-0.0875,1.0,(0.2034, 7.3338)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 20 | 21 | 22 | 23 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0257,0.0,0.0,0.4824,(-0.0558, 12.489)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 24 | 25 | 26 | 27 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0,0.0875,1.0,(3.5586, 0.0)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 28 | 29 | 30 | 31 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,0.0875,1.0,(3.5586, 3.5718)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 32 | 33 | 34 | 35 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,0.1736,-0.1736,0.9848,(4.1986, 7.1819)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 36 | 37 | 38 | 39 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.5,0.0,0.0,0.5,(4.8482, 12.448)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 40 | 41 | 42 | 43 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0,-0.0875,1.0,(7.7272, 0.0)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 44 | 45 | 46 | 47 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,0.0875,1.0,(7.3205, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 48 | 49 | 50 | 51 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.9848,-0.1736,0.1736,0.9848,(7.1532, 7.9364)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 52 | 53 | 54 | 55 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.1,0.0,0.0,1.1,(7.3066, 11.0533)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 56 | 57 | 58 | 59 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,0.0875,0.0,1.0,(11.2858, -0.1901)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 60 | 61 | 62 | 63 | \path[draw=black,line cap=,line width=0.2cm,cm={ 1.0,-0.0875,-0.0875,1.0,(11.4891, 3.952)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 64 | 65 | 66 | 67 | \path[draw=black,line cap=,line width=0.2cm,cm={ 0.4824,0.0,0.0,1.0257,(12.4103, 7.4641)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 68 | 69 | 70 | 71 | \path[draw=black,line cap=,line width=0.2cm,shift={(11.7858, 10.7858)}] (1.0186, 1.1705) rectangle (3.3265, 3.4785); 72 | 73 | 74 | 75 | \path[draw=black,line cap=,line width=0.2cm,xscale=1.5,yscale=0.5] (1.0186, 30.0) rectangle (3.3265, 32.3079); 76 | 77 | 78 | 79 | 80 | \end{tikzpicture} 81 | \end{document} 82 | -------------------------------------------------------------------------------- /tests/testfiles/unicode.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 28 | 29 | 47 | 49 | 50 | 52 | image/svg+xml 53 | 55 | 56 | 57 | 58 | 59 | 63 | J'peux manger d'la vitre, ça m'fa pas mal. æøåÆØÅ 72 | 73 | 74 | --------------------------------------------------------------------------------