Quantcast
Channel: Implement LaTeX accent macros - Code Golf Stack Exchange
Browsing all 6 articles
Browse latest View live

Answer by Alexander Nigl for Implement LaTeX accent macros

Python 3, 203 bytesWithout bonus:l=list(input())b=list(""*len(l))try: while 1:s=l.index("\\");t=l[s+1];del l[s+6];del l[s:s+5];b[s] = "b"==t and "_" or "d"==t and "." or "h"==t and "^" or...

View Article


Answer by nimi for Implement LaTeX accent macros

Haskell, 156 * 0.9 = 140.4 bytesg('\\':a:r)=(q,l):g s where q|a=='b'='_'|a=='d'='.'|a=='h'='^'|a=='t'='~';(_,_:l:_:s)=span(<'{')rg(a:b)=('',a):g bg""=[('\n','\n')]f=uncurry(++).unzip.gUsage...

View Article


Answer by PurkkaKoodari for Implement LaTeX accent macros

Pyth, 5146454341 40 bytesI remove the curly braces and split at \, just like Reto Koradi's CJam answer does. The codes bar, dot and hat are recognized simply by the last decimal digit of the character...

View Article

Answer by Reto Koradi for Implement LaTeX accent macros

CJam, 53 bytesSl+'\/(_,S*\@{(i2/49-"_. ^"=\3>'}-_,(S*@\+@@+@@+\}/N\Try it onlineExplanation:S Leading space, to avoid special case for accent at start.l+ Get input, and append it to leading...

View Article

Answer by Alex A. for Implement LaTeX accent macros

Julia, 204 184 bytes * 0.9 = 165.6x->(r=r"\\(\w)\w+{(\w)}";t=[""^endof(x)...];while ismatch(r,x)...

View Article


Implement LaTeX accent macros

IntroductionThe LaTeX typesetting system uses macros for defining accents.For example, the letter ê is produced by \hat{e}.In this challenge, your task is to implement an ASCII version of this...

View Article
Browsing all 6 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>