Additional Symbols Tikzmark and Braces
I am wondering if it is possible to add the extra symbols in this example given the way I have written the code. I have provided a minimal example and another image with the additional symbols of + and times.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{d#1}{d#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(}2x^{5}+x-1tikzmarknode{B}{)}tikzmarknode{C}
{(}3x-2tikzmarknode{D}{)}]&=tikzmarknode{E}{(}2x^{5}+x-1tikzmarknode{F}
{)}tikzmarknode[red]{G}{(}textcolor{red}{3}tikzmarknode[red]{H}
{)}+tikzmarknode{I}{(}3x-2tikzmarknode{J}{)}tikzmarknode[red]{K}
{(}textcolor{red}{10x^{4}+1}tikzmarknode[red]{L}{)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]A.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]B.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]C.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]D.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]E.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]F.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]G.north) -- node[midway, above=3pt] {$pder{g}{x}$}
([yshift=5pt]H.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]I.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]J.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]K.north) -- node[midway, above=3pt] {$pder{f}{x}$}
([yshift=5pt]L.north);
end{tikzpicture}
end{document}
This outputs:

With the above braces I am trying add some additional operations: + and cdot

g'(x) is a little smaller in the code example but if I can add the symbols and I can also add space to compensate later. Is it possible???
tikzmark
add a comment |
I am wondering if it is possible to add the extra symbols in this example given the way I have written the code. I have provided a minimal example and another image with the additional symbols of + and times.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{d#1}{d#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(}2x^{5}+x-1tikzmarknode{B}{)}tikzmarknode{C}
{(}3x-2tikzmarknode{D}{)}]&=tikzmarknode{E}{(}2x^{5}+x-1tikzmarknode{F}
{)}tikzmarknode[red]{G}{(}textcolor{red}{3}tikzmarknode[red]{H}
{)}+tikzmarknode{I}{(}3x-2tikzmarknode{J}{)}tikzmarknode[red]{K}
{(}textcolor{red}{10x^{4}+1}tikzmarknode[red]{L}{)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]A.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]B.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]C.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]D.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]E.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]F.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]G.north) -- node[midway, above=3pt] {$pder{g}{x}$}
([yshift=5pt]H.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]I.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]J.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]K.north) -- node[midway, above=3pt] {$pder{f}{x}$}
([yshift=5pt]L.north);
end{tikzpicture}
end{document}
This outputs:

With the above braces I am trying add some additional operations: + and cdot

g'(x) is a little smaller in the code example but if I can add the symbols and I can also add space to compensate later. Is it possible???
tikzmark
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
1
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32
add a comment |
I am wondering if it is possible to add the extra symbols in this example given the way I have written the code. I have provided a minimal example and another image with the additional symbols of + and times.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{d#1}{d#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(}2x^{5}+x-1tikzmarknode{B}{)}tikzmarknode{C}
{(}3x-2tikzmarknode{D}{)}]&=tikzmarknode{E}{(}2x^{5}+x-1tikzmarknode{F}
{)}tikzmarknode[red]{G}{(}textcolor{red}{3}tikzmarknode[red]{H}
{)}+tikzmarknode{I}{(}3x-2tikzmarknode{J}{)}tikzmarknode[red]{K}
{(}textcolor{red}{10x^{4}+1}tikzmarknode[red]{L}{)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]A.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]B.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]C.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]D.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]E.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]F.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]G.north) -- node[midway, above=3pt] {$pder{g}{x}$}
([yshift=5pt]H.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]I.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]J.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]K.north) -- node[midway, above=3pt] {$pder{f}{x}$}
([yshift=5pt]L.north);
end{tikzpicture}
end{document}
This outputs:

With the above braces I am trying add some additional operations: + and cdot

g'(x) is a little smaller in the code example but if I can add the symbols and I can also add space to compensate later. Is it possible???
tikzmark
I am wondering if it is possible to add the extra symbols in this example given the way I have written the code. I have provided a minimal example and another image with the additional symbols of + and times.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{d#1}{d#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(}2x^{5}+x-1tikzmarknode{B}{)}tikzmarknode{C}
{(}3x-2tikzmarknode{D}{)}]&=tikzmarknode{E}{(}2x^{5}+x-1tikzmarknode{F}
{)}tikzmarknode[red]{G}{(}textcolor{red}{3}tikzmarknode[red]{H}
{)}+tikzmarknode{I}{(}3x-2tikzmarknode{J}{)}tikzmarknode[red]{K}
{(}textcolor{red}{10x^{4}+1}tikzmarknode[red]{L}{)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]A.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]B.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]C.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]D.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]E.north) -- node[midway, above=3pt] {$f(x)$}
([yshift=5pt]F.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]G.north) -- node[midway, above=3pt] {$pder{g}{x}$}
([yshift=5pt]H.north);
draw [decoration={brace},decorate,thick,blue]
([yshift=5pt]I.north) -- node[midway, above=3pt] {$g(x)$}
([yshift=5pt]J.north);
draw [decoration={brace},decorate,thick,red]
([yshift=5pt]K.north) -- node[midway, above=3pt] {$pder{f}{x}$}
([yshift=5pt]L.north);
end{tikzpicture}
end{document}
This outputs:

With the above braces I am trying add some additional operations: + and cdot

g'(x) is a little smaller in the code example but if I can add the symbols and I can also add space to compensate later. Is it possible???
tikzmark
tikzmark
asked Dec 5 at 23:01
MathScholar
6508
6508
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
1
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32
add a comment |
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
1
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
1
1
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32
add a comment |
3 Answers
3
active
oldest
votes
I would actually like to argue that it is more ergonomic to define a style that just inserts the brace path with the node on top, and not to have so many scattered tikzmarknodes. This answer comes with an overbrace style, that can be used as
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
where A is the node you want to overbrace, {$f(x)$} is the node on top and f1 its name. Then it is also much easier to insert the additional signs.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing,calc}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3H)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path ($(A.east)!0.5!(B.west)$) coordinate (auxAB)
($(C.east)!0.5!(D.west)$) coordinate (auxCD)
($(D.east)!0.5!(E.west)$) coordinate (auxDE)
($(E.east)!0.5!(F.west)$) coordinate (auxEF);
path (auxAB|-f1) node[blue]{$cdot$}
([xshift=-3pt]auxCD|-f1) node[blue]{$cdot$} %manual correction
(auxDE|-f1) node[blue]{$+$}
(auxEF|-f1) node[blue]{$cdot$};
end{tikzpicture}
end{document}

If you want to layout of the braces, you only need to adjust the style. For instance, if you want gaps between them, you could do
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
which yields

Note also that I put the signs on top of the signs of the underlying equation. If you want them in the middle, this will be even easier.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path[blue] (f1) -- (g1) node[midway] {$cdot$}
(f2) -- (dg1) node[midway] {$cdot$}
(dg1) -- (g2) node[midway] {$+$}
(g2) -- (df1) node[midway] {$cdot$};
end{tikzpicture}
end{document}

I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
add a comment |
Despite being a very powerful tool, tikz can be too costly for some tasks. Here I use overbrace and a small hack to add the operators while occupying 0pt width using a makebox[0pt]{..} macro. Also, as @LoopSpace suggested, we can make the braces at the same height by adding vphantom{x^5} to parentheses without that term.
documentclass{article}
usepackage{amsmath}
begin{document}
newcommand{hide}[2]{makebox[0pt][l]{$hspace{#1pt}#2$}}
[
frac{d}{dx}[overbrace{(2x^5+x-1)}^{f(x)hide{20}{cdot}} overbrace{(vphantom{x^5}3x-2)}^{g(x)}]
= overbrace{(2x^5+x-1)}^{f(x)hide{15}{cdot}} overbrace{(vphantom{x^5}3)}^{g'(x)hide{2}{+}}
+ overbrace{(vphantom{x^5}3x-2)}^{g(x)hide{10}{cdot}} overbrace{(10x^4+1)}^{f'(x)}
]
end{document}

1
Loath as I am to discourage use oftikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with thevphantom{x^5}as in marmot's answer to get the braces level.
– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
add a comment |
For fun, another simple solution with the overbracecommand and pstricks:
documentclass{article}
usepackage{mathtools, esdiff}
usepackage{pst-node}
begin{document}
begin{align*}
diff{}{x}bigl[(textcolor{red}{overbrace{strutcolor{black}2x^{5}+x-1}^{Rnode{f}{textstyle f(x)}} textcolor{black}{ )(}overbrace{strutcolor{black}3x-2}^{Rnode{g}{textstyle g(x)}}})bigr] &= (textcolor{blue}{overbrace{color{black}2x^{5}+x-1}^{Rnode{bluef}{textstyle f(x})}})textcolor{red}{overbrace{strut(3)}^{Rnode{dg}{textstyle g'(x)}} }+ (textcolor{blue}{overbrace{strutcolor{black}3x-2}^{Rnode{blueg}{textstyle g(x)}}} )textcolor{red}{(overbrace{10x^{4}+1}^{Rnode{df}{textstyle f'(x )}})}%
%% Additional symbols
psset{linestyle=none}
ncline{f}{g}ncput{boldsymbolcdot}
ncline{bluef}{dg}ncput{boldsymbolcdot}
ncline{blueg}{df}ncput{boldsymbolcdot}
ncline{blueg}{dg}ncput{ + }
end{align*}
end{document}

add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463423%2fadditional-symbols-tikzmark-and-braces%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would actually like to argue that it is more ergonomic to define a style that just inserts the brace path with the node on top, and not to have so many scattered tikzmarknodes. This answer comes with an overbrace style, that can be used as
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
where A is the node you want to overbrace, {$f(x)$} is the node on top and f1 its name. Then it is also much easier to insert the additional signs.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing,calc}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3H)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path ($(A.east)!0.5!(B.west)$) coordinate (auxAB)
($(C.east)!0.5!(D.west)$) coordinate (auxCD)
($(D.east)!0.5!(E.west)$) coordinate (auxDE)
($(E.east)!0.5!(F.west)$) coordinate (auxEF);
path (auxAB|-f1) node[blue]{$cdot$}
([xshift=-3pt]auxCD|-f1) node[blue]{$cdot$} %manual correction
(auxDE|-f1) node[blue]{$+$}
(auxEF|-f1) node[blue]{$cdot$};
end{tikzpicture}
end{document}

If you want to layout of the braces, you only need to adjust the style. For instance, if you want gaps between them, you could do
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
which yields

Note also that I put the signs on top of the signs of the underlying equation. If you want them in the middle, this will be even easier.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path[blue] (f1) -- (g1) node[midway] {$cdot$}
(f2) -- (dg1) node[midway] {$cdot$}
(dg1) -- (g2) node[midway] {$+$}
(g2) -- (df1) node[midway] {$cdot$};
end{tikzpicture}
end{document}

I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
add a comment |
I would actually like to argue that it is more ergonomic to define a style that just inserts the brace path with the node on top, and not to have so many scattered tikzmarknodes. This answer comes with an overbrace style, that can be used as
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
where A is the node you want to overbrace, {$f(x)$} is the node on top and f1 its name. Then it is also much easier to insert the additional signs.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing,calc}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3H)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path ($(A.east)!0.5!(B.west)$) coordinate (auxAB)
($(C.east)!0.5!(D.west)$) coordinate (auxCD)
($(D.east)!0.5!(E.west)$) coordinate (auxDE)
($(E.east)!0.5!(F.west)$) coordinate (auxEF);
path (auxAB|-f1) node[blue]{$cdot$}
([xshift=-3pt]auxCD|-f1) node[blue]{$cdot$} %manual correction
(auxDE|-f1) node[blue]{$+$}
(auxEF|-f1) node[blue]{$cdot$};
end{tikzpicture}
end{document}

If you want to layout of the braces, you only need to adjust the style. For instance, if you want gaps between them, you could do
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
which yields

Note also that I put the signs on top of the signs of the underlying equation. If you want them in the middle, this will be even easier.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path[blue] (f1) -- (g1) node[midway] {$cdot$}
(f2) -- (dg1) node[midway] {$cdot$}
(dg1) -- (g2) node[midway] {$+$}
(g2) -- (df1) node[midway] {$cdot$};
end{tikzpicture}
end{document}

I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
add a comment |
I would actually like to argue that it is more ergonomic to define a style that just inserts the brace path with the node on top, and not to have so many scattered tikzmarknodes. This answer comes with an overbrace style, that can be used as
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
where A is the node you want to overbrace, {$f(x)$} is the node on top and f1 its name. Then it is also much easier to insert the additional signs.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing,calc}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3H)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path ($(A.east)!0.5!(B.west)$) coordinate (auxAB)
($(C.east)!0.5!(D.west)$) coordinate (auxCD)
($(D.east)!0.5!(E.west)$) coordinate (auxDE)
($(E.east)!0.5!(F.west)$) coordinate (auxEF);
path (auxAB|-f1) node[blue]{$cdot$}
([xshift=-3pt]auxCD|-f1) node[blue]{$cdot$} %manual correction
(auxDE|-f1) node[blue]{$+$}
(auxEF|-f1) node[blue]{$cdot$};
end{tikzpicture}
end{document}

If you want to layout of the braces, you only need to adjust the style. For instance, if you want gaps between them, you could do
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
which yields

Note also that I put the signs on top of the signs of the underlying equation. If you want them in the middle, this will be even easier.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path[blue] (f1) -- (g1) node[midway] {$cdot$}
(f2) -- (dg1) node[midway] {$cdot$}
(dg1) -- (g2) node[midway] {$+$}
(g2) -- (df1) node[midway] {$cdot$};
end{tikzpicture}
end{document}

I would actually like to argue that it is more ergonomic to define a style that just inserts the brace path with the node on top, and not to have so many scattered tikzmarknodes. This answer comes with an overbrace style, that can be used as
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
where A is the node you want to overbrace, {$f(x)$} is the node on top and f1 its name. Then it is also much easier to insert the additional signs.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing,calc}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3H)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path ($(A.east)!0.5!(B.west)$) coordinate (auxAB)
($(C.east)!0.5!(D.west)$) coordinate (auxCD)
($(D.east)!0.5!(E.west)$) coordinate (auxDE)
($(E.east)!0.5!(F.west)$) coordinate (auxEF);
path (auxAB|-f1) node[blue]{$cdot$}
([xshift=-3pt]auxCD|-f1) node[blue]{$cdot$} %manual correction
(auxDE|-f1) node[blue]{$+$}
(auxEF|-f1) node[blue]{$cdot$};
end{tikzpicture}
end{document}

If you want to layout of the braces, you only need to adjust the style. For instance, if you want gaps between them, you could do
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
which yields

Note also that I put the signs on top of the signs of the underlying equation. If you want them in the middle, this will be even easier.
documentclass{article}
usepackage{tikz,mathtools}
usetikzlibrary{tikzmark}
usetikzlibrary{decorations.pathreplacing}
%%% Derivative Macro
newcommand{der}[2]{dfrac{mathrm{d}#1}{mathrm{d}#2}}
%%% Derivative Prime Notation
newcommand{pder}[2]{#1^{prime}(#2)}
tikzset{overbrace/.style args={#1 with #2 called #3}{
insert path={[decoration={brace},decorate] ([yshift=5pt,xshift=1pt]#1.north west)
-- node[midway, above=3pt] (#3) {#2}
([yshift=5pt,xshift=-1pt]#1.north east) }
}}
begin{document}
begin{align*}
der{}{x} [tikzmarknode{A}{(2x^{5}+x-1)}
tikzmarknode{B}{vphantom{x^{5}}(3x-2)}]
&=tikzmarknode{C}{(2x^{5}+x-1)}
tikzmarknode[red]{D}{vphantom{x^{5}}(3)}
+tikzmarknode{E}{vphantom{x^{5}}(3x-2)}
tikzmarknode[red]{F}{(10x^{4}+1)}
end{align*}
begin{tikzpicture}[overlay, remember picture]
draw[blue,thick,overbrace={A with {$f(x)$} called f1}];
draw[blue,thick,overbrace={B with {$g(x)$} called g1}];
draw[blue,thick,overbrace={C with {$f(x)$} called f2}];
draw[red,thick,overbrace={D with {$pder{g}{x}$} called dg1}];
draw[blue,thick,overbrace={E with {$g(x)$} called g2}];
draw[red,thick,overbrace={F with {$pder{f}{x}$} called df1}];
path[blue] (f1) -- (g1) node[midway] {$cdot$}
(f2) -- (dg1) node[midway] {$cdot$}
(dg1) -- (g2) node[midway] {$+$}
(g2) -- (df1) node[midway] {$cdot$};
end{tikzpicture}
end{document}

edited Dec 5 at 23:32
answered Dec 5 at 23:24
marmot
87.2k4100187
87.2k4100187
I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
add a comment |
I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
I guess it is ! I think you did not want the "H" in the post. I would also space the braces so they do not touch each other. I like the style technique which is making me look like a real rookie! :)
– MathScholar
Dec 5 at 23:27
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
@MathScholar Sorry about the H. It is gone in the last option (which I was writing when I saw your comment.) The lower two options have gaps.
– marmot
Dec 5 at 23:32
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
thank you for this. I will have to play around with this and make things fit for the example in the code. I did not think it was possible! You proved me wrong
– MathScholar
Dec 5 at 23:34
add a comment |
Despite being a very powerful tool, tikz can be too costly for some tasks. Here I use overbrace and a small hack to add the operators while occupying 0pt width using a makebox[0pt]{..} macro. Also, as @LoopSpace suggested, we can make the braces at the same height by adding vphantom{x^5} to parentheses without that term.
documentclass{article}
usepackage{amsmath}
begin{document}
newcommand{hide}[2]{makebox[0pt][l]{$hspace{#1pt}#2$}}
[
frac{d}{dx}[overbrace{(2x^5+x-1)}^{f(x)hide{20}{cdot}} overbrace{(vphantom{x^5}3x-2)}^{g(x)}]
= overbrace{(2x^5+x-1)}^{f(x)hide{15}{cdot}} overbrace{(vphantom{x^5}3)}^{g'(x)hide{2}{+}}
+ overbrace{(vphantom{x^5}3x-2)}^{g(x)hide{10}{cdot}} overbrace{(10x^4+1)}^{f'(x)}
]
end{document}

1
Loath as I am to discourage use oftikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with thevphantom{x^5}as in marmot's answer to get the braces level.
– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
add a comment |
Despite being a very powerful tool, tikz can be too costly for some tasks. Here I use overbrace and a small hack to add the operators while occupying 0pt width using a makebox[0pt]{..} macro. Also, as @LoopSpace suggested, we can make the braces at the same height by adding vphantom{x^5} to parentheses without that term.
documentclass{article}
usepackage{amsmath}
begin{document}
newcommand{hide}[2]{makebox[0pt][l]{$hspace{#1pt}#2$}}
[
frac{d}{dx}[overbrace{(2x^5+x-1)}^{f(x)hide{20}{cdot}} overbrace{(vphantom{x^5}3x-2)}^{g(x)}]
= overbrace{(2x^5+x-1)}^{f(x)hide{15}{cdot}} overbrace{(vphantom{x^5}3)}^{g'(x)hide{2}{+}}
+ overbrace{(vphantom{x^5}3x-2)}^{g(x)hide{10}{cdot}} overbrace{(10x^4+1)}^{f'(x)}
]
end{document}

1
Loath as I am to discourage use oftikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with thevphantom{x^5}as in marmot's answer to get the braces level.
– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
add a comment |
Despite being a very powerful tool, tikz can be too costly for some tasks. Here I use overbrace and a small hack to add the operators while occupying 0pt width using a makebox[0pt]{..} macro. Also, as @LoopSpace suggested, we can make the braces at the same height by adding vphantom{x^5} to parentheses without that term.
documentclass{article}
usepackage{amsmath}
begin{document}
newcommand{hide}[2]{makebox[0pt][l]{$hspace{#1pt}#2$}}
[
frac{d}{dx}[overbrace{(2x^5+x-1)}^{f(x)hide{20}{cdot}} overbrace{(vphantom{x^5}3x-2)}^{g(x)}]
= overbrace{(2x^5+x-1)}^{f(x)hide{15}{cdot}} overbrace{(vphantom{x^5}3)}^{g'(x)hide{2}{+}}
+ overbrace{(vphantom{x^5}3x-2)}^{g(x)hide{10}{cdot}} overbrace{(10x^4+1)}^{f'(x)}
]
end{document}

Despite being a very powerful tool, tikz can be too costly for some tasks. Here I use overbrace and a small hack to add the operators while occupying 0pt width using a makebox[0pt]{..} macro. Also, as @LoopSpace suggested, we can make the braces at the same height by adding vphantom{x^5} to parentheses without that term.
documentclass{article}
usepackage{amsmath}
begin{document}
newcommand{hide}[2]{makebox[0pt][l]{$hspace{#1pt}#2$}}
[
frac{d}{dx}[overbrace{(2x^5+x-1)}^{f(x)hide{20}{cdot}} overbrace{(vphantom{x^5}3x-2)}^{g(x)}]
= overbrace{(2x^5+x-1)}^{f(x)hide{15}{cdot}} overbrace{(vphantom{x^5}3)}^{g'(x)hide{2}{+}}
+ overbrace{(vphantom{x^5}3x-2)}^{g(x)hide{10}{cdot}} overbrace{(10x^4+1)}^{f'(x)}
]
end{document}

edited Dec 6 at 0:05
answered Dec 5 at 23:47
AboAmmar
33.1k22882
33.1k22882
1
Loath as I am to discourage use oftikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with thevphantom{x^5}as in marmot's answer to get the braces level.
– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
add a comment |
1
Loath as I am to discourage use oftikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with thevphantom{x^5}as in marmot's answer to get the braces level.
– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
1
1
Loath as I am to discourage use of
tikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with the vphantom{x^5} as in marmot's answer to get the braces level.– Loop Space
Dec 5 at 23:58
Loath as I am to discourage use of
tikzmark, I think it is really useful to see what can be achieved with simpler stuff. I do think it could do with the vphantom{x^5} as in marmot's answer to get the braces level.– Loop Space
Dec 5 at 23:58
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
Sure, that improves the look of the equation, I added this, thanks.
– AboAmmar
Dec 6 at 0:08
add a comment |
For fun, another simple solution with the overbracecommand and pstricks:
documentclass{article}
usepackage{mathtools, esdiff}
usepackage{pst-node}
begin{document}
begin{align*}
diff{}{x}bigl[(textcolor{red}{overbrace{strutcolor{black}2x^{5}+x-1}^{Rnode{f}{textstyle f(x)}} textcolor{black}{ )(}overbrace{strutcolor{black}3x-2}^{Rnode{g}{textstyle g(x)}}})bigr] &= (textcolor{blue}{overbrace{color{black}2x^{5}+x-1}^{Rnode{bluef}{textstyle f(x})}})textcolor{red}{overbrace{strut(3)}^{Rnode{dg}{textstyle g'(x)}} }+ (textcolor{blue}{overbrace{strutcolor{black}3x-2}^{Rnode{blueg}{textstyle g(x)}}} )textcolor{red}{(overbrace{10x^{4}+1}^{Rnode{df}{textstyle f'(x )}})}%
%% Additional symbols
psset{linestyle=none}
ncline{f}{g}ncput{boldsymbolcdot}
ncline{bluef}{dg}ncput{boldsymbolcdot}
ncline{blueg}{df}ncput{boldsymbolcdot}
ncline{blueg}{dg}ncput{ + }
end{align*}
end{document}

add a comment |
For fun, another simple solution with the overbracecommand and pstricks:
documentclass{article}
usepackage{mathtools, esdiff}
usepackage{pst-node}
begin{document}
begin{align*}
diff{}{x}bigl[(textcolor{red}{overbrace{strutcolor{black}2x^{5}+x-1}^{Rnode{f}{textstyle f(x)}} textcolor{black}{ )(}overbrace{strutcolor{black}3x-2}^{Rnode{g}{textstyle g(x)}}})bigr] &= (textcolor{blue}{overbrace{color{black}2x^{5}+x-1}^{Rnode{bluef}{textstyle f(x})}})textcolor{red}{overbrace{strut(3)}^{Rnode{dg}{textstyle g'(x)}} }+ (textcolor{blue}{overbrace{strutcolor{black}3x-2}^{Rnode{blueg}{textstyle g(x)}}} )textcolor{red}{(overbrace{10x^{4}+1}^{Rnode{df}{textstyle f'(x )}})}%
%% Additional symbols
psset{linestyle=none}
ncline{f}{g}ncput{boldsymbolcdot}
ncline{bluef}{dg}ncput{boldsymbolcdot}
ncline{blueg}{df}ncput{boldsymbolcdot}
ncline{blueg}{dg}ncput{ + }
end{align*}
end{document}

add a comment |
For fun, another simple solution with the overbracecommand and pstricks:
documentclass{article}
usepackage{mathtools, esdiff}
usepackage{pst-node}
begin{document}
begin{align*}
diff{}{x}bigl[(textcolor{red}{overbrace{strutcolor{black}2x^{5}+x-1}^{Rnode{f}{textstyle f(x)}} textcolor{black}{ )(}overbrace{strutcolor{black}3x-2}^{Rnode{g}{textstyle g(x)}}})bigr] &= (textcolor{blue}{overbrace{color{black}2x^{5}+x-1}^{Rnode{bluef}{textstyle f(x})}})textcolor{red}{overbrace{strut(3)}^{Rnode{dg}{textstyle g'(x)}} }+ (textcolor{blue}{overbrace{strutcolor{black}3x-2}^{Rnode{blueg}{textstyle g(x)}}} )textcolor{red}{(overbrace{10x^{4}+1}^{Rnode{df}{textstyle f'(x )}})}%
%% Additional symbols
psset{linestyle=none}
ncline{f}{g}ncput{boldsymbolcdot}
ncline{bluef}{dg}ncput{boldsymbolcdot}
ncline{blueg}{df}ncput{boldsymbolcdot}
ncline{blueg}{dg}ncput{ + }
end{align*}
end{document}

For fun, another simple solution with the overbracecommand and pstricks:
documentclass{article}
usepackage{mathtools, esdiff}
usepackage{pst-node}
begin{document}
begin{align*}
diff{}{x}bigl[(textcolor{red}{overbrace{strutcolor{black}2x^{5}+x-1}^{Rnode{f}{textstyle f(x)}} textcolor{black}{ )(}overbrace{strutcolor{black}3x-2}^{Rnode{g}{textstyle g(x)}}})bigr] &= (textcolor{blue}{overbrace{color{black}2x^{5}+x-1}^{Rnode{bluef}{textstyle f(x})}})textcolor{red}{overbrace{strut(3)}^{Rnode{dg}{textstyle g'(x)}} }+ (textcolor{blue}{overbrace{strutcolor{black}3x-2}^{Rnode{blueg}{textstyle g(x)}}} )textcolor{red}{(overbrace{10x^{4}+1}^{Rnode{df}{textstyle f'(x )}})}%
%% Additional symbols
psset{linestyle=none}
ncline{f}{g}ncput{boldsymbolcdot}
ncline{bluef}{dg}ncput{boldsymbolcdot}
ncline{blueg}{df}ncput{boldsymbolcdot}
ncline{blueg}{dg}ncput{ + }
end{align*}
end{document}

answered Dec 6 at 0:47
Bernard
166k769193
166k769193
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f463423%2fadditional-symbols-tikzmark-and-braces%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Do you really need a hammersledge like tikz for this?
– Bernard
Dec 5 at 23:22
1
@Bernhard, it is the way I have been trained but I am interested in a "way" out if possible?
– MathScholar
Dec 5 at 23:24
@Bernard If you are already using TikZ, then of course it's no overhead to use it for this. Likewise, if already using pstricks then your solution is great. One thing I love about this site is how people chime in with alternative solutions using different technologies. Although not always relevant to the OP, they are relevant to people looking for similar ideas. So please never think that just because the OP says "TikZ" that a psticks - or pure TeX - solution isn't welcome! (One of my most upvoted answers was a TikZ answer on an xy-matrix question.)
– Loop Space
Dec 6 at 7:32