#StackBounty: #tikz-pgf Viviani curve with no self intersection

Bounty: 50

I was trying to make the following in TiKz which I made using Mathematica, which is the intersection of a sphere and cylinder similar to the Viviani’s curve.

enter image description here.

I want to highlight the shaded region of the intersection of a solid ball with a cylinder (the intersection is the blue curve and the region is the region bounded by the blue curve) which I was unable to make into TiKz. I don’t have a good amount of knowledge of TiKz (still in learning process). I tried to change the code but unable to get the required one. Any help will be appreciated.

Thanks in advance.


Get this bounty!!!

#StackBounty: #tikz-pgf #macros #right-to-left Create an adapted pgfpicture with fixed width for RTL context

Bounty: 100

This is a complement of my question Issue breakable box (tcolorbox package) with babel (layout=graphics)
the problem come from pgfpicture environment. here an example showing the issue

documentclass{article}
usepackage{pgf}
usepackage[showframe]{geometry}

parindent0pt

begin{document}

pagedir TRT pardir TRT textdir TRT bodydir TRT  

A {textdir TLTbegin{pgfpicture}{0pt}{0pt}{50pt}{3cm}
color{red}
pgfpathrectangle{pgfpointorigin}{pgfpoint{10cm}{2cm}}
pgfpathmoveto{pgfpointorigin}
pgfpathlineto{pgfpoint{10cm}{2cm}}
pgfusepath{stroke}
end{pgfpicture}} B    

end{document}

So with begin{pgfpicture}{0pt}{0pt}{50pt}{3cm} contents of environment appears on the margin one can use begin{pgfpicture}{0pt}{0pt}{textwidth}{3cm} to solve the issue but this need to be added inside tcolorbox package and this is not an easy task.

My question is there a solution which consist of redefining pgfpicture to allow a correct result in RTL context (pgfpicture contents in the page not outside).

enter image description here

Result in RTL context should look like this

enter image description here


Get this bounty!!!

#StackBounty: #tikz-pgf #tkz-euclide Draw a balanced fulcrum with cylinder, pyramid and sphere

Bounty: 50

I have been drawn the following figure, showing that the sphere with radius R and cone with base radius 2R and height 2R, away from the pivot with distance 2R, is rotational equilibrium with cylinder that has base radius and height of 2R.

enter image description here

The lengths are indicated in the figure above, and the red dots represent the centre of masses of the objects.

This is the MWE:

documentclass[parskip]{scrartcl}
usepackage[margin=15mm]{geometry}
usepackage{tikz}
usepackage{tkz-euclide}
usetikzlibrary{3d,calc}
usetikzlibrary{shapes.geometric}

begin{document}

begin{tikzpicture}
    %Wall
    draw [fill,pattern=north east lines,draw=none] (-3,3) rectangle (3,3.25);
    draw (-3,3)--(3,3);
    
    %Segment
    draw[|<->|]  (-2,2.45) -- (0.67,2.45) node[midway,fill=white] {$2R$};
    draw[|<->|]  (0.67,2.45) -- (2,2.45) node[midway,fill=white] {$R$};
    draw[|<->|]  (4,1) -- (4,-0.5) node[midway,fill=white] {$2R$};
    draw[|<->|]  (-0.5,1) -- (-0.5,-1) node[midway,fill=white] {$2R$};
    draw[|<->|]  (-0.5,-2) -- (-0.5,-4) node[midway,fill=white] {$2R$};
    draw[|<->|]  (4,1) -- (4,-0.5) node[midway,fill=white] {$2R$};
    draw[|<->|]  (1,1.25) -- (2,1.25) node[midway,fill=white] {$R$};
    draw[|<->|]  (3,1.25) -- (2,1.25) node[midway,fill=white] {$R$};
    
    %Fulcrum
    draw[thick, fill=yellow, yellow] (-2.01,2) rectangle (2.01,2.25);
    
    %Lines hanging objects
    draw[thick] (-2,2)--(-2,1)  (0.67,2.25)--(0.67,3) (-2,-1)--(-2,-2) (2,1)--(2,2);
    
    %Sphere
    draw (-3,0) arc (180:360:1cm and 0.5cm);
    draw[dashed] (-3,0) arc (180:0:1cm and 0.5cm);
    draw (-2,1) arc (90:270:0.5cm and 1cm);
    draw[dashed] (-2,1) arc (90:-90:0.5cm and 1cm);
    draw (-2,0) circle (1cm);
    shade[ball color=blue!10!white,opacity=0.20] (-2,0) circle (1cm);
    tkzDefPoint(-2,0){A} 
    tkzDrawPoints[color=red, fill=red](A)
    
    %Cone
    draw (-3,-4) arc (180:360:1cm and 0.5cm) -- (-2,-2) -- cycle;
    draw[dashed] (-3,-4) arc (180:0:1cm and 0.5cm);
    shade[left color=blue!5!white,right color=blue!40!white,opacity=0.3] (-3,-4) arc (180:360:1cm and 0.5cm) -- (-2,-2) -- cycle;
    draw (-2,-4)--(-1,-4);
    node at (-1.5,-3.7) {$2R$};
     tkzDefPoint(-2,-3){B} 
    tkzDrawPoints[color=red, fill=red](B)
    
    %Cylinder
    draw (1,1) arc (90:270:0.75cm and 1.5cm);
    draw[dashed] (1,1) arc (90:-90:0.75cm and 1.5cm);
    draw (3,1) arc (90:270:0.75cm and 1.5cm);
    draw (3,1) arc (90:-90:0.75cm and 1.5cm);
    draw (1,1)--(3,1) (1,-2)--(3,-2);
    shade[left color=green!5!white,right color=green!40!white,opacity=0.3] (1,1) arc (90:270:0.75cm and 1.5cm)--(1,-2)--(3,-2)--(3,-2) arc (-90:90:0.75cm and 1.5cm)--cycle;
    tkzDefPoint(2,-0.5){C} 
    tkzDrawPoints[color=red, fill=red](C)
    
    
end{tikzpicture}

end{document}

On the other hand, I would like to take infinitesimal thickness of Δx, away with distance x (in blue) as shown in below:

enter image description here

It seems there would be hard to take the infinitesimal thickness of Δx for sphere since it is hard to calculate the height of a small portion explicitly. Is there any ways to draw it nicely?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B is in the first column of the table in row 3.
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B is in the first column of the table in row 3.
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B is in the first column of the table in row 3.
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B is in the first column of the table in row 3.
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B is in the first column of the table in row 3.
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B%
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!

#StackBounty: #tikz-pgf #arrays #exam #xspace How to embed choices in tabular in exam class?

Bounty: 50

Similar to the question: Exam class multiple choice answers in table format,
I’m trying to embed the choices into a table format and looking like a table.

documentclass[11pt]{exam}
usepackage{mathtools}
usepackage{xspace}
usepackage{array}
usepackage{tikz}
printanswers
newcommand{wideunderline}[2][2em]{%
  underline{makebox[ifdimwidth>#1widthelse#1fi][c]{#2}}%
}
begin{document}

fbox{parbox{linewidth}{
When compared to the graph of $y=f(x)$, the graph of $8y=f(-x)$ has been reflected in the wideunderline[1.5cm]{textit{i}} and vertically stretched about the x-axis by a factor of wideunderline[1.5cm]{textit{ii}}}}medskip
begin{questions}
question The statement above is completed by the information in row:medskip

begin{choices}
renewcommandarraystretch{1.5}
choice A
correctchoice B
choice C
choice D
end{choices}

question I want choice B embedded in the table. 
%begin{choices}%%%is this possible?
begin{tabular}{|c|c|c|}
hline
    textbf{Row }& textbf{textit{i}}&textbf{textit{ii}}\
    hline
    A &  $y$-axis&8\ 
    hline
        B &  $y$-axis&$frac{1}{8}$\%I would like the choice to be embeded i.e. choice B%
    hline
        C &  $x$-axis&8\
    hline
        D &  $x$-axis&$frac{1}{8}$\
    hline
end{tabular}
%end{choices}%%%%doesn't work. 
end{questions}
end{document}

Can anyone help me with this?


Get this bounty!!!