GithubHelp home page GithubHelp logo

jinhxu / mdtable2latex Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 9 KB

Handy thesis tool, convert a markdown table to a Latex table, implemented in Python.

Python 100.00%
latex markdown python python3 thesis paper tool parsing string-manipulation string strings papers theses

mdtable2latex's Introduction

MDtable2Latex

Kept experiment results documented in Markdwon? Run this script to convert large MD tables to Latex. #10minutestobuildatool

Requirements

Python 3.x

Example

input Markdown table

| Number samples | minutes| accuracy | F-score (macro) | M1 F1 |  M2 F1 | F1 F1 | M1 acc\recall | M2 acc\recall | F1 acc/recall |
| --- | --- | --- | ---| ---|---|---| --- | --- | --- |
|30|2|0.95|0.948|0.914|0.931|1.0|0.965|0.918|1.0|
|50|3.5|0.971|0.97|0.952|0.96|1.0|0.984|0.936|1.0|
|75|5|0.985|0.985|0.976|0.978|1.0|0.992|0.965|1.0|
|105|7|0.986|0.986|0.979|0.979|1.0|0.983|0.975|1.0|
|128|9|0.987|0.987|0.981|0.982|1.0|0.996|0.968|1.0|

output Latex table

\begin{center}\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
 Number samples & minutes& accuracy & F-score (macro) & M1 F1 &  M2 F1 & F1 F1 & M1 acc\recall & M2 acc\recall & F1 acc/recall \\
\hline
30&2&0.95&0.948&0.914&0.931&1.0&0.965&0.918&1.0\\
\hline
50&3.5&0.971&0.97&0.952&0.96&1.0&0.984&0.936&1.0\\
\hline
75&5&0.985&0.985&0.976&0.978&1.0&0.992&0.965&1.0\\
\hline
105&7&0.986&0.986&0.979&0.979&1.0&0.983&0.975&1.0\\
\hline
128&9&0.987&0.987&0.981&0.982&1.0&0.996&0.968&1.0\\
\hline
\end{tabular}\end{center}

Usage

Copy paste your Markdown table into inpt_md.txt

Run the script:

$ python ./mdtable2latex.py

Copy paste opt_latex.txt to your main.tex1

And we are done ๐ŸŽ‰๐ŸŽ‰

1: You may need to manually take care of the Latex escape symbols.

mdtable2latex's People

Contributors

jinhxu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.