7

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?

Neuron
  • 5,141
  • 5
  • 38
  • 59
Thomas Ahle
  • 30,774
  • 21
  • 92
  • 114
  • 3
    I think the only way you're going to be able to make use of those diagonal characters is to have them meet at the corners of character cells, rather than the middle - that way you only need the two characters to make boxes. (There are a couple of variations of the crossing diagonal lines in Supplemental Arrows-B, that have one line visibly passing in front of the other, that might be of use to you.) – jasonharper Nov 17 '19 at 15:10
  • 1
    I agree with @jasonharper. And with a monospace font it probably looks exactly like you've intended it (i.e. [see the output here](https://tio.run/##yy9OTMpM/f9fSUE/RgEI9GO49BUUQMwYfS4gpQ8RA/IUIGJcCo@mbnw0dROIC2FxASkQexNYZBOQxwXmgIVhaqAyCnA1Sv//AwA), where the top is with regular ASCII slashes (codepoint `47,92`) and the bottom one with [box-drawing slashes](https://en.wikipedia.org/wiki/Box-drawing_character#Unicode) (codepoints `9585,9586`). TIO (apparently) uses the font `'DejaVu Sans Mono', monospace` in case you're wondering). – Kevin Cruijssen Nov 22 '19 at 12:52

2 Answers2

4

The character you are looking for does not exist. You can however do this (as suggested by @jasonharper):

╱╲
╲╱

or alternatively:

 ╱╲
╱  ╲
╲  ╱
 ╲╱
Neuron
  • 5,141
  • 5
  • 38
  • 59
2

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.

Guest
  • 36
  • 1