1

I want to make rounded corners on one side only like this:

\tikz{
\fill[red]
(0,0) +(8pt,8pt) arc (0:-90:8pt) -- (0,1) arc (90:0:8pt)
}

The points (0,0) and (0,1) in the above are placeholders. I actually want to use the lower and upper right corners of a node. Thus:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikz{
\node[inner sep=8, fill=red](subh){
\parbox{2cm}{
some multiline text
}
\hspace{-8pt}
}
\fill[red]
(subh.below right) +(8pt,8pt) arc (0:-90:8pt) -- (subh.above right) arc (90:0:8pt);
}
\end{document}

This causes XeLaTeX to start an apparently neverending compilation. How to make it work? (I'm asking for a solution in this vein. What I'm actually going to try next, as I need the result quickly, is to make a 2x3 table with text spanning the first column, it and the middle cell of the second one having blue background and with TikZ-made quarter-circles in the rest.)

ByteEater
  • 145
  • Welcome to TeX.SE! Aren't you just missing some semicolons at the end of the paths? Try \documentclass[tikz,border=3.14mm]{standalone} \begin{document} \tikz{ \node[inner sep=8, fill=red,text width=2cm](subh){some multiline text}; \fill[red](subh.-45) +(8pt,8pt) arc (0:-90:8pt) -- (subh.45) arc (90:0:8pt); } \end{document} –  Feb 02 '19 at 05:03
  • I am indeed! Somehow it works in the first snippet without one, despite the Wikibook. But adding it in the second one doesn't solve the problem. – ByteEater Feb 02 '19 at 05:13
  • Does my above code run through? –  Feb 02 '19 at 05:16
  • It unfortunately still doesn't work with your \fill[red](subh.-45) +(8pt,8pt) arc (0:-90:8pt) -- (subh.45) arc (90:0:8pt);. – ByteEater Feb 02 '19 at 05:16
  • My above code is a so-called minimal working example, it starts with \documentclass and ends with \end{document}. Can you turn you code into such an example? –  Feb 02 '19 at 05:20
  • Sure. `\documentclass{article} \usepackage{tikz}

    \begin{document} \tikz{ \nodeinner sep=8, fill=red{ \parbox{2cm}{ some multiline text } \hspace{-8pt} } \fill[red] (subh.below right) +(8pt,8pt) arc (0:-90:8pt) -- (subh.above right) arc (90:0:8pt); } \end{document}`

    – ByteEater Feb 02 '19 at 05:26
  • The ; are still missing, so is\end{document}, below right is not a valid node anchor, nor is above right, and this works: \documentclass{article} \usepackage{tikz} \begin{document} \tikz{ \node[inner sep=8, fill=red](subh){ \parbox{2cm}{ some multiline text } \hspace{-8pt} }; \fill[red]{ (subh.-45) +(8pt,8pt) arc (0:-90:8pt) -- (subh.45) arc (90:0:8pt) };} \end{document} And please add your example to the question (and not in a comment). –  Feb 02 '19 at 05:29
  • A semicolon is missing at the end of \node[inner sep=8, fill=red](subh){ \parbox{2cm}{ some multiline text } \hspace{-8pt} } – AndréC Feb 02 '19 at 06:05
  • @AndréC Yes, this is what I said twice above. –  Feb 02 '19 at 06:07
  • For a single rounded corner see e.g. https://tex.stackexchange.com/a/28118/121799 or https://tex.stackexchange.com/a/32869/121799 . –  Feb 02 '19 at 06:07
  • Edited. The missing semicolon you're referring to seems to be required after node – I didn't realize that's a path too. Reading a tutorial misled me to above, below and right; I've replaced with north, south and east, respectively. What do the numbers in places of anchors mean? They seem to be in degrees, akin to Haskell's diagrams library. So, is -45 equivalent to south east and 45 to north east? And are there additional possibilities, e.g. 20?

    But your example, @marmot, from #comment1192532_472993 still doesn't produce the desired effect.

    – ByteEater Feb 02 '19 at 06:33
  • @ByteEater 45 and north east are not necessarily the same, so if you want north east, then take it. Yes, nodes are also paths. And yes, you can add any angle like 20. And I really think you might benefit from having a look at https://tex.stackexchange.com/a/28118/121799, where nodes with rounded corners on one side only are discussed. They come with the shape rounded rectangle, which is defined in the shapes.misc library. –  Feb 02 '19 at 06:38
  • @ByteEater \node is not part of the path. It is the TikZ syntax that requires that each instruction be ended with a semicolon. – AndréC Feb 02 '19 at 07:30
  • 1
    @AndréC \node is an abbreviation for \path node (p.222, pgfmanual, v3.1) – Paul Gaborit Feb 02 '19 at 08:27
  • @PaulGaborit read the page 218 Nodes are added to paths using the special path operation node. Nodes are not part of the path itself. – AndréC Feb 02 '19 at 08:43
  • 1
    @AndréC Do not confuse syntax and semantics. Syntactically, \node is a \path operation. This explains the addition of ; at the end (as for all \path). – Paul Gaborit Feb 02 '19 at 08:51

0 Answers0