Giter VIP home page Giter VIP logo

ffcode's Introduction

Fixed-Font LaTeX Primitive: \ff and \begin{ffcode}

make CTAN License

This LaTeX package helps you write source code in your academic papers and make sure it looks neat. The package uses listings and tcolorbox packages.

First, install it from CTAN and then use in the preamble:

\documentclass{article}
\usepackage{ffcode}
\begin{document}
The function \ff{r()} reads the file:
\begin{ffcode}
void r() {
  // read the file
}
\end{ffcode}
\end{document}

Otherwise, you can download ffcode.sty and add to your project.

If you want to contribute yourself, make a fork, then create a branch, then run l3build ctan in the root directory. It should compile everything without errors. If not, submit an issue and wait. Otherwise, make your changes and then run l3build ctan again. If the build is still clean, submit a pull request.

ffcode's People

Contributors

renovate[bot] avatar rultor avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ffcode's Issues

Special characters cannot be escaped

I have LaTeX special characters in my code, namely { and }. These cause Overleaf to show errors during compiling. I have tried to escape the characters with { and } respectively which works outside of the ffcode block, but inside the formatted code block it displays both the backslash and curly bracket characters.
Screenshot 2023-06-05 at 00 31 56
Can this be amended so that escaped special characters are treated the same in ffcode as in other parts of the LaTeX file?

move to fancyvrb

I think it's time to abandon minted and start using fancyvrb, since it's much lighter and doesn't involve pygmentize

Weird behaviour with Alloy language

I need to include a model written in Alloy (an horrible language that somewhat allows for first-order-logic constructs, don't learn it, trust me, I used it only this once because I was forced to and I regret it) into my latex document, ffcode worked really well untill I started using some more elaborate logical expressions, mainly the second sets of curly brackes that follows each "sig", after that it stops treating the text as code halfway through.
I suppose the unconventional syntax causes some kind of issue.

This is only part of the code, but its enough to demonstrate the undesirable behaviour:

\begin{ffcode}
   sig Date {
	unixTime: one Int
    } {
    	unixTime >= 0
    }
    //Radomly chosen by Alloy
    one sig Now extends Date {}
    
    sig Location {}
    sig Email {}
    sig UserName {}
    sig Password {}
    sig CompanyName {}
    sig PaymentMethod {}
    
    abstract sig Bool {}
    one sig True extends Bool {}
    one sig False extends Bool {}
    
    sig User {
    	userName: one UserName,
    	email: one Email,
    	password: one Password,
    	paymentMethod: one PaymentMethod,
    	bookings: set Booking
    } {
    	//No user can have two overlapping bookings
    	all b1, b2: Booking | (b1 in bookings and b2 in bookings)
    	implies
    	(b1 = b2 or (b1.startDate.unixTime < b2.startDate.unixTime and b1.endDate.unixTime <= b2.startDate.unixTime) or
    	(b2.startDate.unixTime < b1.startDate.unixTime and b2.endDate.unixTime <= b1.startDate.unixTime))
    }
    
    //Force that a booking of a eMSP is made by a user registered in that eMSP, even tho the eMSP is only one...
    sig Booking {
    	startDate: one Date,
    	endDate: one Date,
    	isActive: one Bool,
    	socket: one Socket
    } {
    	startDate.unixTime < endDate.unixTime
    	and (isActive = True implies startDate.unixTime <= Now.unixTime and Now.unixTime <= endDate.unixTime)
    	and (isActive = True implies socket.connectedVehicle != none)
    }
    
    fact noBookingsWithoutUsers {
    	all b: Booking | (one u: User | b in u.bookings)
    }
    
    fact noExpiredBookings {
    	all b: Booking | b.endDate.unixTime >= Now.unixTime
    }
    
    fact noOverlappingSocketBookings {
    	/*
    	or ((b1.startDate.unixTime < b2.startDate.unixTime implies b1.endDate.unixTime <= b2.startDate.unixTime) and (b1.startDate.unixTime > b2.startDate.unixTime implies b2.endDate.unixTime <= b1.startDate.unixTime))
    	*/
    	all b1, b2: Booking | (b1 = b2 or b1.socket != b2.socket or (b1.startDate.unixTime < b2.startDate.unixTime and b1.endDate.unixTime <= b2.startDate.unixTime)
    	or (b2.startDate.unixTime < b1.startDate.unixTime and b2.endDate.unixTime <= b1.startDate.unixTime))
    }
    
    run {} for 12 but 6 Int, exactly 3 User, exactly 3 CS, exactly 2 CPMS, exactly 3 Booking
\end{ffcode}

Here is a picture of the unexpected behaviour:
capture

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/l3build.yml
  • actions/checkout v4
  • actions/setup-python v5
  • teatimeguest/setup-texlive-action v3.2.1
  • JamesIves/github-pages-deploy-action v4.6.1
.github/workflows/markdown-lint.yml
  • actions/checkout v4
  • articulate/actions-markdownlint v1
  • ubuntu 22.04
.github/workflows/yamllint.yml
  • actions/checkout v4
  • ibiqlik/action-yamllint v3
  • ubuntu 22.04

  • Check this box to trigger a request for Renovate to run again on this repository

ffcode highlight

When we use minted (pygments) as default, languages are not stored \minted@lang. maybe I didn't understand?

[condensed] option

Would be nice to have an ability to condense the text (smaller distance between letters):

\begin[condensed]{ffcode}
Hello, world!
\end{ffcode}

Or maybe have an additional ffcode2x environment:

\begin{ffcode2x}
Hello, world!
\end{ffcode}

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.