Shop OBEX P1 Docs P2 Docs Learn Events
How can I post code in my school paper keeping original spaceing? — Parallax Forums

How can I post code in my school paper keeping original spaceing?

Tony_tsiTony_tsi Posts: 98
edited 2012-08-20 13:58 in Propeller 1
I need to post a copy of some code that I wrote into a school paper. Is there any way to keep the spacing correct? If I just Copy and paste it looks like Smile. I have seen people post code on here before and It looks great any Ideas or suggestions would be greatly appreciated. Thankyou

Comments

  • PublisonPublison Posts: 12,366
    edited 2012-08-20 09:16
    Use Phil's "Most Excellent' link.

    attachment.php?attachmentid=78421&d=1297987572

  • Tony_tsiTony_tsi Posts: 98
    edited 2012-08-20 09:28
    I just tried it, It doesn't work in Microsoft word.
  • Mike GMike G Posts: 2,702
    edited 2012-08-20 09:38
    Use courier font (non-true type) in a word processor. Plus you must be mindful of the line length.

    Use code tags [ code ] My Code [ /code ] to preserve formatting on the forums.

    This post should be moved to the general discussion forum.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-08-20 10:11
    You can also use the Parallax font in Word to preserve spacing. It looks great, too, assuming you stick within a small range of point sizes. If you do it a lot, define a "code" style in Word, that includes the font, point-size, and any background color (light gray is typical) that you want to use for it.

    -Phil
  • SRLMSRLM Posts: 5,045
    edited 2012-08-20 10:56
    In general, you use mono-spaced font for code. I typically prefer courier new, but any mono-spaced font will look ok.
  • RDL2004RDL2004 Posts: 2,554
    edited 2012-08-20 13:13
    Yes, you need a mono-spaced font where each character is the same width. Take a look at the Deja Vu Sans Mono font. It's derived from Bitstream Vera. I like it because both 0 and O, and 1 and l are very distinct from each other. I'm not sure where or how I got the Deja Vu font, but the original Vera Sans is a free download.
  • CircuitsoftCircuitsoft Posts: 1,166
    edited 2012-08-20 13:58
    DejaVu fonts often come with OpenOffice/LibreOffice. For code, I actually prefer either Liberation Sans Mono or the Terminus fonts.
Sign In or Register to comment.