Tada
This commit is contained in:
@@ -9,10 +9,14 @@ latex_symbols = {
|
||||
"ohm": r"\Omega",
|
||||
"A": r"\text{A}",
|
||||
"V": r"\text{V}",
|
||||
"milliamperes": r"\text{mA}",
|
||||
"*": r"\cdot",
|
||||
"N*m": r"\text{N} \cdot \text{m}",
|
||||
"in*lb": r"\text{in} \cdot \text{lb}",
|
||||
"||": r"\|",
|
||||
"−": r"-",
|
||||
"μ": r"\mu",
|
||||
"−": r"-",
|
||||
}
|
||||
|
||||
|
||||
@@ -66,25 +70,30 @@ def copy_to_clipboard(text):
|
||||
|
||||
|
||||
def main():
|
||||
# Input the qalc expression
|
||||
expression = input("Enter qalc expression: ")
|
||||
try:
|
||||
while True:
|
||||
# Input the qalc expression
|
||||
expression = input("\nEnter qalc expression (Ctrl+C to exit): ")
|
||||
|
||||
# Run qalc and get the result
|
||||
qalc_output = run_qalc(expression)
|
||||
# Run qalc and get the result
|
||||
qalc_output = run_qalc(expression)
|
||||
|
||||
# Format the input expression for LaTeX
|
||||
latex_expression = format_expression_for_latex(expression)
|
||||
# Format the input expression for LaTeX
|
||||
latex_expression = format_expression_for_latex(expression)
|
||||
|
||||
# Format the output result for LaTeX
|
||||
latex_result = format_result_for_latex(qalc_output)
|
||||
# Format the output result for LaTeX
|
||||
latex_result = format_result_for_latex(qalc_output)
|
||||
|
||||
# Combine both input expression and result for final LaTeX output
|
||||
final_latex_output = f"${latex_expression} {latex_result}$"
|
||||
# Combine both input expression and result for final LaTeX output
|
||||
final_latex_output = f"{latex_expression} {latex_result}"
|
||||
|
||||
# Print and copy to clipboard
|
||||
print(f"Final LaTeX output:\n{final_latex_output}")
|
||||
copy_to_clipboard(final_latex_output)
|
||||
print("LaTeX result copied to clipboard!")
|
||||
# Print and copy to clipboard
|
||||
print(f"Final LaTeX output:\n{final_latex_output}")
|
||||
copy_to_clipboard(final_latex_output)
|
||||
print("LaTeX result copied to clipboard!")
|
||||
|
||||
except KeyboardInterrupt:
|
||||
print("\nExiting...")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user