Listing code in beamer frame Unicorn Meta Zoo #1: Why another podcast? ...

What to do with someone that cheated their way through university and a PhD program?

Raising a bilingual kid. When should we introduce the majority language?

Approximating integral with small parameter

Implementing 3DES algorithm in Java: is my code secure?

How to keep bees out of canned beverages?

As an international instructor, should I openly talk about my accent?

What is purpose of DB Browser(dbbrowser.aspx) under admin tool?

Is it acceptable to use working hours to read general interest books?

What is the best way to deal with NPC-NPC combat?

Double-nominative constructions and “von”

Long vowel quality before R

Has a Nobel Peace laureate ever been accused of war crimes?

Why do distances seem to matter in the Foundation world?

Why doesn't the standard consider a template constructor as a copy constructor?

Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?

Is Diceware more secure than a long passphrase?

Does Feeblemind produce an ongoing magical effect that can be dispelled?

What ability score does a Hexblade's Pact Weapon use for attack and damage when wielded by another character?

My admission is revoked after accepting the admission offer

Can we hide a text first in a picture and then hide that image again in one more image?

I preordered a game on my Xbox while on the home screen of my friend's account. Which of us owns the game?

What was Apollo 13's "Little Jolt" after MECO?

What does a straight horizontal line above a few notes, after a changed tempo mean?

Older movie/show about humans on derelict alien warship which refuels by passing through a star



Listing code in beamer frame



Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraCan't insert code in my beamer slideSource code listing with frame around code?LaTeX - Multiple pages on a code listing inside a beamer frameFrame around minipage containing listing in beamerNumerical conditional within tikz keys?Using mcode within a beamer frameListing in Beamer Frame - halts after warningBeamer: handout/article mode - produce multiple copies of a frame with distinct overlay numberslisting in minipage sucks content of previous page to the bottomCustom command for begin-frame with package beamerarticleListing inside a frame using beamer












0















I have a problem with the package listings in beamer, when used in a frame. I report below a MWE (actually, it gives an error message). If I don't use begin{frame} end{frame}, then the example below works fine. However I need to enclose it in a slide/frame!



documentclass{beamer}
usepackage{listings} % Include the listings-package

begin{document}


begin{frame}
frametitle{Solving LREM: Matlab implementation}

begin{lstlisting}
Define ns, nc, ns1, ns2
Define matrices of the state-space form P,W and U
s0 = zeros(ns,1); % initial conditions for the states
epsilon = randn(T,1); % draw random shocks
s = zeros(ns,T); u = zeros(nc,T);
s(:,1) = s0;
for t=2:T % start for-loop
qquad s(:,t) = P*s(:,t-1)+W*epsilon(t);
qquad u(:,t) = U*s(:,t);
end % close for-loop
end{lstlisting}


end{frame}









share|improve this question


















  • 1





    Use begin{frame}[fragile]

    – Phelype Oleinik
    21 mins ago











  • Possible duplicate of Can't insert code in my beamer slide

    – Marijn
    18 mins ago
















0















I have a problem with the package listings in beamer, when used in a frame. I report below a MWE (actually, it gives an error message). If I don't use begin{frame} end{frame}, then the example below works fine. However I need to enclose it in a slide/frame!



documentclass{beamer}
usepackage{listings} % Include the listings-package

begin{document}


begin{frame}
frametitle{Solving LREM: Matlab implementation}

begin{lstlisting}
Define ns, nc, ns1, ns2
Define matrices of the state-space form P,W and U
s0 = zeros(ns,1); % initial conditions for the states
epsilon = randn(T,1); % draw random shocks
s = zeros(ns,T); u = zeros(nc,T);
s(:,1) = s0;
for t=2:T % start for-loop
qquad s(:,t) = P*s(:,t-1)+W*epsilon(t);
qquad u(:,t) = U*s(:,t);
end % close for-loop
end{lstlisting}


end{frame}









share|improve this question


















  • 1





    Use begin{frame}[fragile]

    – Phelype Oleinik
    21 mins ago











  • Possible duplicate of Can't insert code in my beamer slide

    – Marijn
    18 mins ago














0












0








0








I have a problem with the package listings in beamer, when used in a frame. I report below a MWE (actually, it gives an error message). If I don't use begin{frame} end{frame}, then the example below works fine. However I need to enclose it in a slide/frame!



documentclass{beamer}
usepackage{listings} % Include the listings-package

begin{document}


begin{frame}
frametitle{Solving LREM: Matlab implementation}

begin{lstlisting}
Define ns, nc, ns1, ns2
Define matrices of the state-space form P,W and U
s0 = zeros(ns,1); % initial conditions for the states
epsilon = randn(T,1); % draw random shocks
s = zeros(ns,T); u = zeros(nc,T);
s(:,1) = s0;
for t=2:T % start for-loop
qquad s(:,t) = P*s(:,t-1)+W*epsilon(t);
qquad u(:,t) = U*s(:,t);
end % close for-loop
end{lstlisting}


end{frame}









share|improve this question














I have a problem with the package listings in beamer, when used in a frame. I report below a MWE (actually, it gives an error message). If I don't use begin{frame} end{frame}, then the example below works fine. However I need to enclose it in a slide/frame!



documentclass{beamer}
usepackage{listings} % Include the listings-package

begin{document}


begin{frame}
frametitle{Solving LREM: Matlab implementation}

begin{lstlisting}
Define ns, nc, ns1, ns2
Define matrices of the state-space form P,W and U
s0 = zeros(ns,1); % initial conditions for the states
epsilon = randn(T,1); % draw random shocks
s = zeros(ns,T); u = zeros(nc,T);
s(:,1) = s0;
for t=2:T % start for-loop
qquad s(:,t) = P*s(:,t-1)+W*epsilon(t);
qquad u(:,t) = U*s(:,t);
end % close for-loop
end{lstlisting}


end{frame}






beamer listings






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 22 mins ago









AlessandroAlessandro

615




615








  • 1





    Use begin{frame}[fragile]

    – Phelype Oleinik
    21 mins ago











  • Possible duplicate of Can't insert code in my beamer slide

    – Marijn
    18 mins ago














  • 1





    Use begin{frame}[fragile]

    – Phelype Oleinik
    21 mins ago











  • Possible duplicate of Can't insert code in my beamer slide

    – Marijn
    18 mins ago








1




1





Use begin{frame}[fragile]

– Phelype Oleinik
21 mins ago





Use begin{frame}[fragile]

– Phelype Oleinik
21 mins ago













Possible duplicate of Can't insert code in my beamer slide

– Marijn
18 mins ago





Possible duplicate of Can't insert code in my beamer slide

– Marijn
18 mins ago










0






active

oldest

votes












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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487551%2flisting-code-in-beamer-frame%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f487551%2flisting-code-in-beamer-frame%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

Installing LyX: “No textclass is found.”LyX installation error- text class not found- 'Reconfigure' or...

(1602) Indiana Índice Designación y nombre Características orbitales Véase...

Universidad Autónoma de Occidente Índice Historia Campus Facultades Programas Académicos Medios de...