I want to write the following code in latex, such that in pdf, we see the same format of writing (except background color and font colors). However, by algorithmic, output format is different. Is there any other way to write a code (and not pseudo-code) to see an output similar to the following code (Please do not consider the colors and fonts).

enter image description here

  • 8
    There are packages which handle different programming languages; on the top of my mind listings and minted. Of course, if you don't care for automatic highlighting of syntax, you can just use the verbatim environment. – campa Aug 21 '18 at 8:33
  • 2
    What is "pseudo-code", and what exactly do you want to achieve by "same format of writing"? Do you want the font to be monospaced? Do you want to have the correct indenting? Do you care about the bolding (or otherwise highlighting) of key words, do you insist to never use highlighting or are you fine if it is convenient? – YiFan Aug 21 '18 at 11:00
  • @user496634 In fact, I got my answer by comment of @campa. There is also a Solidity language package for listings HERE: link – Questioner Aug 21 '18 at 14:05

According to the comment of User campa, I found my answer in this repository where there is a specific package for listings specialized for Solidity programming language. In fact for most of the programming languages there is a customized package. Most practical information exists HERE.

In my case, where the language is Solidity, there is a specific package for listings HERE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.