unicodeasciiascii-art

Unicode box drawing diagonals


I have a table that I'm drawing using diagonal lines in ascii. Basically a mix of /\^V<>, like this:

  ^
 / \
<   >
 \ /
  v

I would prefer to write this using unicode characters more fit for the job, like , and , but I lack characters for ^, V, < and >, so I can only do this:

  ╳
 ╱ ╲
╳   ╳
 ╲ ╱
  ╳

Which turns out to be insufficient for what I'm trying to convey.

I wonder if there are some box-drawing characters I'm missing?

I'm basically going by this block, and it might be that another block has something more suitable for drawing diagonals. I also checked out http://shapecatcher.com/, and it suggests using e.g. a capital Lambda, Λ, for ^, but things still don't quite match up.

If there are currently no such characters, do you know if there are any plans for adding them, or can you think of another nice way to display such a table in the terminal?


Solution

  • I hope this isn't too much of a necropost. I also want to know.

    Ok, I'm going to hyperfocus on this. I'm going to give you every possible option I can find. Since this is a asthetic matter, you have to choose for yourself based on the project and its needs. I draw my own conclusion based on similarity to a turned square, which I assume is the goal here.

    And it turns out, no, you're not really missing a special character space that has all the answers. I wish.

    Firstly, it seems like you're specifically intent on using only 1 char per angle in your diamonds. This is going to artificially limit your options.

    The usual whitespace interior of a 2 char diamond vs a 1 char diamond:

      /\                        ^
     /░░\                      /░\
    /░hi░\ can't center text  <░!░>  can center text
    \░hi░/                     \░/
     \░░/                       v
      \/
    

    If the above diagram doesn't matter for your project, then please consider using a 2 char diamond as they are much easier to construct.


    2 chars per angle (if centering isn't a hurdle for you): The headings are the names of the unicode blocks that these characters come from.

    Basic Latin

         /\
        /  \    basic solidus diamond for comparison
       /    \     
       \    /       \ slash: solidus
        \  /        / backslash: reverse solidus
         \/
    

    Box Drawing

         ╱╲                                        ╱╲
        ╱  ╲      box drawing diagonals           /  \
       ╱    ╲                                    /    \
       ╲    ╱      like solidus, but jagged.     \    /
        ╲  ╱       you could mix and match        \  /
         ╲╱        for the best of both worlds:    ╲╱
    
         ▟▙
        ▟▘▝▙      fun with quadrants and half blocks
       ▟▘  ▝▙     
       ▜▖  ▗▛        
        ▜▖▗▛         
         ▜▛
    

    Miscellaneous Mathematical Symbols-A

           ⟋⟍
         ⟋    ⟍        mathematical rising/falling diagonal
       ⟋        ⟍   
       ⟍        ⟋       
         ⟍    ⟋    
           ⟍⟋        ||
                      ||       not grid-friendly width
    

    Halfwidth and Fullwidth Forms

           /\
         /    \        fullwidth solidus + reverse solidus
       /        \      basically a perfect diamond
       \        /      grid-friendly only if your grid is in fullwidth,
         \    /        the width of CJK ideographs like 爱
           \/          fullwidth space: " "
    

    Miscellaneous Mathematical Symbols-B

        ⧸⧹
       ⧸  ⧹
      ⧸    ⧹     "big solidus"
      ⧹    ⧸
       ⧹  ⧸         
        ⧹⧸
    

    Mixed

    Box Drawing

         ██      
       ██  ██     double full blocks
     ██      ██      (2 char up & down, 1 char right & left)
       ██  ██    
         ██      
    

    1 char per angle (To keep things sensical, I'm going to omit angles when the unicode block we're exploring doesn't have any to experiment with):

    Basic Latin

       ^
      / \     your example for comparison
     <   >    aka the "There Must Be A Better Way To Do This" diamond
      \ /     which we have all struggled with!
       v        
    

    Box Drawing

       █
      █ █     single full blocks
     █   █
      █ █        
       █ 
    
       ▄
      ▞ ▚     half blocks and quadrants
     ▐   ▌       cramped
      ▚ ▞        
       ▀
    

    Miscellaneous Technical Miscellaneous Technical

       ⍲    "Apl functional symbol up caret tilde" width issues
      /  \
      \  /
       ⍱    "Apl functional symbol down caret tilde"
    
    
       ⌃
      / \    up/down arrowhead
      \ /
       ⌄
    
    
      ⎠⎝     various parenthesis (probably not useful)
      
      ⎞⎛
    
      /\
     〈   〉    angle brackets look promising
      \/     unfortunately, width makes it not grid-friendly
    

    ("Right-pointing angle bracket" in Miscellaneous Technical is the same as "Mathematical right angle bracket" in Miscellaneous Mathematical Symbols-A)

    Can you tell the difference?

    ⟩  〉
    

    Phonetic Extensions

     ^    ^    (normal caret)
    / \  / \    
    \ /  \ /   Left: "Latin subscript small letter v"
     ᵥ    ᵛ    Right: "Modifier letter small v"
    
     ᴧ    ᴧ   "Greek letter small capital lamda"
    / \  / \
    \ /  \ /
     v    ᴠ   normal v for comparison, and "Latin letter small capital v"
    

    Miscellaneous Mathematical Symbols-B

      /\          
     ⦑   ⦒    |   Left/Right angle bracket with dot
      \/     |        width problems
             |
      /\
     ⦉   ⦊   "Z notation [left/right] binding bracket"
      \/            same width problem
    

    Dingbats

     /\
    ❬  ❭    "Medium [left/right]-pointing angle bracket ornament"
     \/          good width    
    

    General Punctuation

     /\
    ‹  ›  "Single [left/right]-pointing angle quotation mark" aka guillemets
     \/        
                   good width
    

    Unified Canadian Aboriginal Syllabics

      ᐱ    ||
     / \   ||    would be great if not for those pesky width issues
    ᐸ   ᐳ  ||   ᐱ: Canadian syllabics pi  ᐯ: pe ᐳ: po ᐸ: pa
     \ /   ||    
      ᐯ    ||
    

    Conclusion:

    The world's best centered unicode diamond (with no width issues) might be.... (using normal solidus and reverse solidus as the lines here):

      ᴧ 
     / \     
    ❬   ❭
     \ /
      ᴠ
    

    again the original for comparison:

      ^
     / \
    <   >
     \ /
      v
    

    That's right, the day is saved by Dingbats and the IPA. Honestly, isn't it always?


    But if you ask me, a little bit of artistic creativity might make it a lot more accessible....

       |
      / \    using simple solidus (slashes), dashes, and | <-this thing
     -   -
      \ /
       |
    

    I guess it depends on how pointy you want to get.

    Or, for completeness' sake, the other direction:

       ▁
      / \    block elements 1/8th characters (up, down, left, right)
     ▕   ▏
      \ /
       ▔
    

    Thank you for coming on this journey with me. I hope you found it at least somewhat useful.