Why Ladder Logic Breaks in Web Editors
Ladder logic represented as ASCII art depends entirely on fixed-width (monospace) character rendering. Every character must occupy identical horizontal space so contacts, coils, branch lines, and rail symbols align column-by-column. Web WYSIWYG editors almost universally default to proportional fonts (Arial, Verdana, Helvetica), where an | pipe character is narrower than an M, collapsing carefully spaced rungs into unreadable noise the moment you paste.
Secondary failure modes include:
- Editor HTML sanitizers collapsing consecutive spaces to a single
or stripping them entirely - Auto-formatting engines removing leading whitespace on paste
- Line-feed normalization converting
\r\nto<br>, shifting vertical spacing - Clipboard-to-HTML conversion embedding invisible span tags that break column alignment
ASCII Ladder Diagram Conventions
No universal standard exists, but the following character set has the widest cross-platform fidelity using only 7-bit ASCII (CP437/UTF-8 compatible):
| Element | Symbol(s) | Example |
|---|---|---|
| Left power rail | | |
| |
| Right power rail | | |
| |
| Horizontal wire |
- (hyphen) |
---- |
| Normally Open contact | -[ ]- |
-[I001]-- |
| Normally Closed contact | -[/]- |
-[/I002]- |
| Output coil | -( )- |
-(O005)- |
| Negated coil | -(/)- |
-(/O006)- |
| Vertical branch wire | | |
branch junction |
| Branch open top | + |
parallel start |
| Branch close bottom | + |
parallel end |
| Function block | [BOX] |
[TON T4:0] |
Minimal Two-Rung Example
|----[I:0/0]----[/I:0/1]--------------(O:0/0)----| Rung 0000
|
|----[I:0/2]----+----[I:0/3]----+----(O:0/1)----| Rung 0001
| | |
| +----[I:0/4]----+
|
Render this in Courier New 10 pt or Consolas 10 pt. Both fonts are available on Windows, macOS, and most Linux desktops, ensuring the recipient sees identical column widths.
Recommended Authoring Workflow
- Open a plain-text editor — Notepad++ (notepad-plus-plus.org), VS Code, or even Windows Notepad. Set font to Courier New or Consolas, size 10.
- Set encoding to UTF-8 (no BOM). Avoid Windows-1252; the curly-quote substitutions it produces corrupt pipe characters on Linux readers.
- Draw rungs using only standard ASCII characters (codes 32–126). Avoid box-drawing Unicode (U+2500 range); they render correctly in some terminals but fail in most web forms.
- Verify alignment by toggling the editor's word-wrap OFF and scanning column positions visually.
- Copy the text block (Ctrl+A, Ctrl+C).
- In the target forum or documentation system, insert a code/preformatted block first (BBCode:
[code]...[/code]; Markdown: fence with triple backticks; HTML:<pre><code>...</code></pre>), then paste inside it using Ctrl+Shift+V (paste without formatting). - Preview before submitting. Check that pipe characters are vertically aligned and spacing matches the source.
[code] tags that enforce monospace rendering server-side regardless of the editor font. Always wrap ladder ASCII in [code][/code], never in [quote] or bare text.Font and Encoding Specifications
| Font | Platform | Fixed-Width? | Web-Safe? | Notes |
|---|---|---|---|---|
| Courier New | Win/Mac/Linux | Yes | Yes | Widely supported; slightly narrow at small sizes |
| Consolas | Win (Office) | Yes | No | Best clarity 9–12 pt; not universally installed on Linux |
| Lucida Console | Win | Yes | Partial | Good for terminals; less common on Mac |
| Monaco | macOS | Yes | No | macOS default monospace; not on Windows |
| DejaVu Sans Mono | Linux | Yes | No | Open source; embed via @font-face for web docs |
| Arial / Verdana | All | No | Yes | Proportional — breaks all ASCII ladder alignment |
For internal documentation (Word, PDF), set the code style to Courier New 9 pt, no kerning, character spacing = 0 pt. In Microsoft Word: Format → Font → Advanced → Kerning for fonts: uncheck. This prevents Word's automatic kerning from shifting column alignment at print time.
Exporting Ladder from the PLC IDE
The cleanest way to share ladder logic is to export a screenshot or PDF from the native IDE. This eliminates all ASCII formatting problems.
| IDE | Export Method | Output Format |
|---|---|---|
| Studio 5000 Logix Designer | File → Print → Print to PDF; or cross-reference report | PDF, HTML report |
| RSLogix 500 | File → Print Preview → Print to PDF | |
| TIA Portal v19 | Project → Export → LAD/FBD network screenshot (Ctrl+Print Screen on selected network) | PNG, PDF |
| GX Works3 | Project → Print → Ladder (PDF) | |
| Do-more Designer | File → Print → Print Ladder to PDF | |
| CODESYS 3.5 | File → Print → Print current POU; export XML via Project → Export | PDF, XML |
For image uploads to forums, target PNG format, ≤ 1200 px wide, ≤ 150 KB. Use IrfanView or ImageMagick to batch-resize: magick ladder_rung.png -resize 1200x> -quality 85 ladder_rung_web.png.
Workarounds for Forum Image Size Limits
Many PLC forums enforce pixel-dimension limits that are narrower than typical screen captures (commonly 800 px wide, occasionally as low as 550 px). Strategies:
- Crop to the specific rung: Select only the ladder rung area in the IDE before screenshotting. Eliminates toolbar chrome and whitespace.
- Scale the IDE zoom to 75% before capturing: reduces pixel dimensions while keeping text legible.
-
Use a free image host (imgur.com, postimages.org) and embed the direct-link URL in the forum post using
[img]URL[/img]BBCode. Bypasses the forum's upload pixel limit entirely. - Attach as PDF: Most forums allow PDF attachments with higher size ceilings than images. A full-page rung printout as PDF is universally readable.
Why does my ladder ASCII art look correct in Notepad but breaks when pasted into a forum post?
The forum editor applies a proportional font (Arial or Verdana) to the input area, collapsing fixed-width column alignment. Always wrap ladder ASCII in the forum's [code]...[/code] BBCode tags before pasting; this forces the server to render the block in monospace regardless of editor font.
Which monospace font should I use for PLC ladder documentation in Microsoft Word?
Use Courier New 9–10 pt with kerning disabled (Format → Font → Advanced → uncheck Kerning). Consolas is visually superior but lacks universal installation on non-Windows systems, which causes misalignment when documents are opened on macOS or Linux.
What is the maximum image size for uploading ladder screenshots to most PLC forums?
Limits vary by forum software configuration; common values are 800 × 600 px at 150 KB for embedded images. If your rung exceeds this, crop to the active logic area only, scale the IDE view to 75%, or host the image externally on imgur.com and embed the URL with [img] tags.
How do I export ladder logic as PDF from Studio 5000 Logix Designer?
In Studio 5000, navigate to File → Print, select a PDF printer driver (Microsoft Print to PDF on Windows 10/11, or a third-party driver), choose the routines to include, and print. Alternatively, use Reports → Cross Reference for a searchable HTML export of all tags and rungs.
Can I use Unicode box-drawing characters (U+2500–U+257F) for ladder diagrams?
Avoid them for shared content. Box-drawing characters render correctly in terminals and text editors that support UTF-8 with a compatible font, but web forum software frequently strips or substitutes them during HTML encoding, corrupting the diagram. Stick to 7-bit ASCII (| - + [ ] ( )) for maximum portability.