Skip to content

Commit

Permalink
need triple braces for f-string
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrollnt committed Feb 28, 2022
1 parent 74b9039 commit 1b261f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tikzplotlib/_line2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _table(obj, data): # noqa: C901

opts_str = ("[" + ",".join(opts) + "] ") if len(opts) > 0 else ""
posix_filepath = rel_filepath.as_posix()
content.append(f"table {{opts_str}}{{{posix_filepath}}};\n")
content.append(f"table {{{opts_str}}}{{{posix_filepath}}};\n")
else:
if len(opts) > 0:
opts_str = ",".join(opts)
Expand Down

2 comments on commit 1b261f4

@Naikless
Copy link

@Naikless Naikless commented on 1b261f4 Apr 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my system, this results in {<contents of opts_str>} in the tex file, which is incorrect. It should only be content.append(f"table {opts_str}{{{posix_filepath}}};\n"), i.e. single brace.

@atrettin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks external tables. The resulting string is table {opts_str}{my_data.dat}. The Latex compilation fails because it doesn't find a file named opts_str, obviously. Concurring with @daharn , this should only be content.append(f"table {opts_str}{{{posix_filepath}}};\n").

Please sign in to comment.