Qiskit / Qiskit/qiskit

Fix latex output to match qiskit-texbook norms

Open
#8,317 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: enhancement
Dominant language
Python
Stars
7.8k
Forks
3k
Avg merge
3d 13h
Merged PRs (30d)
70

Description

Environment
  • Qiskit Terra version: 0.20.2
  • Python version: Python 3.10.5 (main, Jun 11 2022, 16:53:24) [GCC 9.4.0] on linux
  • Operating system: Linux - Elementary OS
What is happening?

Currently, the latex output has multiple aesthetic issues that would be really helpful if fixed. I am listing the issues as follows -

1.A leading space is prefixed with the latex output string.
2. If there are multiple None terms together - Currently, it looks like this (multiple ldots) $\ldots+ \ldots+ \ldots $ . But it can be clubbed together to a single ldot $+ \ldots$
3. The notation in various textbooks follows the following - <sign> <term><bra/ket> but currently, the signs stick to the previous ket.
4. Can the terms be de-rationalized? Rationalizing the terms doesn't seem to make any sense to me if we're looking at the latex output.

How can we reproduce the issue?

@1ucian0 - How do I put in a code for all the test cases? Need some help here.

What should happen?

The latex output should closely resemble the textbook output.

Any suggestions?

Take a look at state_visualization.py

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with qiskit/visualization/state_visualization.py, which the issue identifies as the relevant entry point for LaTeX generation. Reproduce the listed output cases and trace how leading spaces, consecutive None terms, sign placement, and rationalization are handled; done means the output matches the stated qiskit-texbook norms.

Written by the indexing model from the issue text.

Assessment

Tech stack
latex, python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.