Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDL in LaTeX #12

Open
arademaker opened this issue Jun 18, 2021 · 5 comments
Open

TDL in LaTeX #12

arademaker opened this issue Jun 18, 2021 · 5 comments

Comments

@arademaker
Copy link
Member

Do we have any package or extension for https://www.overleaf.com/learn/latex/Code_listing to show TDL code?

@fcbond
Copy link
Member

fcbond commented Jun 19, 2021 via email

@goodmami
Copy link
Member

In my dissertation I just did some ad-hoc listings style for transfer rules only (see below). Perhaps you could extend it?

Another alternative is to use the minted package with a Pygments style. I have a complete Pygments lexer for TDL in the delphin.highlight package. See this article for instructions (I haven't tested them) for using custom lexers with Minted in Overleaf.

Listings style for transfer rules:

\lstdefinestyle{MtrStyle}{
  basicstyle=\ttfamily\footnotesize,
  alsoletter={-+*\#},
  morekeywords=[2]{
    CONTEXT,INPUT,FILTER,OUTPUT,FLAGS,OPTIONAL,
    LTOP,INDEX,RELS,HCONS,
    PRED,LBL,ARG0,ARG1,ARG2,ARG3,ARG4,
    L-INDEX,L-HNDL,R-INDEX,R-HNDL,RSTR,CARG,
    qeq,HARG,LARG
  },
  morekeywords=[3]{
    \#x0, \#x1, \#x2, \#x3, \#x4, \#x5, \#x6, \#x7, \#x8, \#x9, \#x,
    \#e0, \#e1, \#e2, \#e3, \#e4, \#e5, \#e6, \#e7, \#e8, \#e9, \#e,
    \#h0, \#h1, \#h2, \#h3, \#h4, \#h5, \#h6, \#h7, \#h8, \#h9, \#h,
    \#i0, \#i1, \#i2, \#i3, \#i4, \#i5, \#i6, \#i7, \#i8, \#i9, \#i,
    \#p0, \#p1, \#p2, \#p3, \#p4, \#p5, \#p6, \#p7, \#p8, \#p9, \#p,
    \#u0, \#u1, \#u2, \#u3, \#u4, \#u5, \#u6, \#u7, \#u8, \#u9, \#u
  },
  keywordstyle=[2]{\color{uwpurplergb!70}},  % red!50!blue
  keywordstyle=[3]{\bfseries\color{uwmetalicgoldrgb}},  % orange
  stringstyle={\itshape\color{uwgoldrgb!50!uwmetalicgoldrgb}},  % green!70!black
  %mathescape=true,
  linewidth=0.9\linewidth
}

(aside: yes, I used official UW brand colors for the syntax highlighting (and throughout my dissertation) and, no, I don't think anyone ever appreciated that fact...)

@arademaker
Copy link
Member Author

How can I define does colors?

@goodmami
Copy link
Member

Here are my definitions:

% see: http://www.washington.edu/brand/graphic-elements/primary-color-palette/                            
                                                                                                          
\definecolor{uwpurple}{rgb}{.29,.18,.51}         % HEX 4b2e83 = (75,46,131)                               
\definecolor{uwpurplergb}{rgb}{.20,.00,.44}      % RGB 255    = (51,0,111)                                
\definecolor{uwgold}{rgb}{.72,.65,.48}           % HEX b7a57a = (183,165,122)                             
\definecolor{uwgoldrgb}{rgb}{.91,.83,.64}        % RGB 255    = (232,211,162)                             
\definecolor{uwgoldweb}{rgb}{.91,.89,.83}        % HEX e8e3d3 = (232,227,211)                             
\definecolor{uwmetalicgold}{rgb}{.52,.46,.30}    % HEX 85754d = (133,117,77)                              
\definecolor{uwmetalicgoldrgb}{rgb}{.57,.48,.30} % RGB 255    = (145,123,76)                              
\definecolor{uwlightgray}{rgb}{.85,.85,.85}      % HEX d9d9d9 = (217,217,217)                             
\definecolor{uwlightgrayrgb}{rgb}{.85,.85,.85}   % RGB 255    = (216,217,218)                             
\definecolor{uwdarkgray}{rgb}{.27,.27,.27}       % HEX 444444 = (68,68,68)                                
\definecolor{uwdarkgrayrgb}{rgb}{.60,.60,.60}    % RGB 255    = (153,153,153)

The hex colors work best for screens, like if your PDF will be viewed on a monitor. The RGB colors work best for print (I think I mistakenly used the hex colors in my printed dissertation and they were too light, but they look good in the PDF). But maybe you'll want to define your own colors?

I think you'll need to import the xcolor package. See here.

@arademaker
Copy link
Member Author

@oepen , can we rename the page https://github.com/delph-in/docs/wiki/LtgOslo_LaTeX to something more general like LateX and add these infos from @goodmami there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants