Using Algorithm in Tufte LaTeX is making error in Captions
up vote
1
down vote
favorite
I am using algorithm
in Tufte LaTeX
documentclass{tufte-book}
usepackage{algorithm}
usepackage[noend]{algpseudocode}
begin{document}
begin{algorithm}captionsetup{font={sc}, labelfont={bf,sc}}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
INPUT $trainingtext{_}examples, alpha, iter$
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
end{document}
Can anyone tell what's wrong?
tufte algorithmicx
add a comment |
up vote
1
down vote
favorite
I am using algorithm
in Tufte LaTeX
documentclass{tufte-book}
usepackage{algorithm}
usepackage[noend]{algpseudocode}
begin{document}
begin{algorithm}captionsetup{font={sc}, labelfont={bf,sc}}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
INPUT $trainingtext{_}examples, alpha, iter$
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
end{document}
Can anyone tell what's wrong?
tufte algorithmicx
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass{...}
and ending withend{document}
.
– samcarter
Apr 27 at 13:24
The code that you provided fails to compile for me. After removing thecaptionsetup
andINPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?
– godbyk
Apr 29 at 3:42
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I am using algorithm
in Tufte LaTeX
documentclass{tufte-book}
usepackage{algorithm}
usepackage[noend]{algpseudocode}
begin{document}
begin{algorithm}captionsetup{font={sc}, labelfont={bf,sc}}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
INPUT $trainingtext{_}examples, alpha, iter$
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
end{document}
Can anyone tell what's wrong?
tufte algorithmicx
I am using algorithm
in Tufte LaTeX
documentclass{tufte-book}
usepackage{algorithm}
usepackage[noend]{algpseudocode}
begin{document}
begin{algorithm}captionsetup{font={sc}, labelfont={bf,sc}}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
INPUT $trainingtext{_}examples, alpha, iter$
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
end{document}
Can anyone tell what's wrong?
tufte algorithmicx
tufte algorithmicx
edited 12 hours ago
Kurt
33.9k846156
33.9k846156
asked Apr 27 at 13:20
Siddharth Kanungo
62
62
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass{...}
and ending withend{document}
.
– samcarter
Apr 27 at 13:24
The code that you provided fails to compile for me. After removing thecaptionsetup
andINPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?
– godbyk
Apr 29 at 3:42
add a comment |
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass{...}
and ending withend{document}
.
– samcarter
Apr 27 at 13:24
The code that you provided fails to compile for me. After removing thecaptionsetup
andINPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?
– godbyk
Apr 29 at 3:42
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass{...}
and ending with end{document}
.– samcarter
Apr 27 at 13:24
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass{...}
and ending with end{document}
.– samcarter
Apr 27 at 13:24
The code that you provided fails to compile for me. After removing the
captionsetup
and INPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?– godbyk
Apr 29 at 3:42
The code that you provided fails to compile for me. After removing the
captionsetup
and INPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?– godbyk
Apr 29 at 3:42
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
With the packages you are using in you code command Input
is not defined. You can define it with
algnewcommandInput{item[textbf{Input:}]}% <=========================
Please see that you need to change your line with INPUT
to
Input{$training_examples, alpha, iter$} % <==========================
With the following MWE
documentclass{tufte-book} % tufte-book article
usepackage{algorithm}
usepackage[noend]{algpseudocode}
algnewcommandInput{item[textbf{Input:}]}% <=========================
usepackage{caption} % <================================================
begin{document}
text
captionsetup{font={sc}, labelfont={bf,sc}} % <=========================
begin{algorithm}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
Input{$training_examples, alpha, iter$} % <==========================
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
text
end{document}
you get the following result:
Please see that tufte
gives you a warning about the usage of caption
! See the caption beside the algorithm as designed in tufte
...
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
With the packages you are using in you code command Input
is not defined. You can define it with
algnewcommandInput{item[textbf{Input:}]}% <=========================
Please see that you need to change your line with INPUT
to
Input{$training_examples, alpha, iter$} % <==========================
With the following MWE
documentclass{tufte-book} % tufte-book article
usepackage{algorithm}
usepackage[noend]{algpseudocode}
algnewcommandInput{item[textbf{Input:}]}% <=========================
usepackage{caption} % <================================================
begin{document}
text
captionsetup{font={sc}, labelfont={bf,sc}} % <=========================
begin{algorithm}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
Input{$training_examples, alpha, iter$} % <==========================
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
text
end{document}
you get the following result:
Please see that tufte
gives you a warning about the usage of caption
! See the caption beside the algorithm as designed in tufte
...
add a comment |
up vote
0
down vote
With the packages you are using in you code command Input
is not defined. You can define it with
algnewcommandInput{item[textbf{Input:}]}% <=========================
Please see that you need to change your line with INPUT
to
Input{$training_examples, alpha, iter$} % <==========================
With the following MWE
documentclass{tufte-book} % tufte-book article
usepackage{algorithm}
usepackage[noend]{algpseudocode}
algnewcommandInput{item[textbf{Input:}]}% <=========================
usepackage{caption} % <================================================
begin{document}
text
captionsetup{font={sc}, labelfont={bf,sc}} % <=========================
begin{algorithm}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
Input{$training_examples, alpha, iter$} % <==========================
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
text
end{document}
you get the following result:
Please see that tufte
gives you a warning about the usage of caption
! See the caption beside the algorithm as designed in tufte
...
add a comment |
up vote
0
down vote
up vote
0
down vote
With the packages you are using in you code command Input
is not defined. You can define it with
algnewcommandInput{item[textbf{Input:}]}% <=========================
Please see that you need to change your line with INPUT
to
Input{$training_examples, alpha, iter$} % <==========================
With the following MWE
documentclass{tufte-book} % tufte-book article
usepackage{algorithm}
usepackage[noend]{algpseudocode}
algnewcommandInput{item[textbf{Input:}]}% <=========================
usepackage{caption} % <================================================
begin{document}
text
captionsetup{font={sc}, labelfont={bf,sc}} % <=========================
begin{algorithm}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
Input{$training_examples, alpha, iter$} % <==========================
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
text
end{document}
you get the following result:
Please see that tufte
gives you a warning about the usage of caption
! See the caption beside the algorithm as designed in tufte
...
With the packages you are using in you code command Input
is not defined. You can define it with
algnewcommandInput{item[textbf{Input:}]}% <=========================
Please see that you need to change your line with INPUT
to
Input{$training_examples, alpha, iter$} % <==========================
With the following MWE
documentclass{tufte-book} % tufte-book article
usepackage{algorithm}
usepackage[noend]{algpseudocode}
algnewcommandInput{item[textbf{Input:}]}% <=========================
usepackage{caption} % <================================================
begin{document}
text
captionsetup{font={sc}, labelfont={bf,sc}} % <=========================
begin{algorithm}
caption{Batch Gradient Descent Algorithm}label{alg:batchgradientdescent}
begin{algorithmic}[1]
Input{$training_examples, alpha, iter$} % <==========================
Function{GradientDescent}{$X, y, alpha, iter$}
State $theta gets$ Initialized to small random values
For{$i in {1,dots,iter}$}
State $Deltatheta_i gets$ 0 Comment{Initialize each $Deltatheta_i$ to 0}
For{each $(x^i, y^i)$ in $training_examples$}
State $h gets theta_0x_0 dots theta_nx_n$ Comment{Compute the output h}
For{each parameter $theta_i$}
State $Deltatheta_i gets Deltatheta_i + alpha(y^i - h)x_i $
EndFor
EndFor
For{each parameter $theta_i$}
State $theta_i gets theta_i + Deltatheta_i$
EndFor
EndFor
EndFunction
end{algorithmic}
end{algorithm}
text
end{document}
you get the following result:
Please see that tufte
gives you a warning about the usage of caption
! See the caption beside the algorithm as designed in tufte
...
answered 12 hours ago
Kurt
33.9k846156
33.9k846156
add a comment |
add a comment |
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%2f428857%2fusing-algorithm-in-tufte-latex-is-making-error-in-captions%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
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass{...}
and ending withend{document}
.– samcarter
Apr 27 at 13:24
The code that you provided fails to compile for me. After removing the
captionsetup
andINPUT
lines, it did compile successfully and the caption appeared as expected in the margin note area. Can you describe the results you're getting and what you're trying to achieve?– godbyk
Apr 29 at 3:42