Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Highlight one line of a listing at a time in LaTeX

View diapo.tex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
\documentclass[12pt]{beamer}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{palatino}
 
\usefonttheme{serif}
 
\lstloadlanguages{fortran}
\lstset{language=fortran,aboveskip=0pt,belowskip=0pt,showlines=true}
\lstdefinestyle{h}{backgroundcolor=\color{orange}}
 
\newcommand{\emphline}[4]{%
\lstinputlisting[linerange={#1}]{#4}
\lstinputlisting[linerange={#2}-{#2},style=h]{#4}
\lstinputlisting[linerange={#3}]{#4}
}
 
\begin{document}
\begin{frame}
\only<1> {\emphline{1-5} {6} {7-15} {potencia.f95}}
\only<2> {\emphline{1-6} {7} {8-15} {potencia.f95}}
\only<3> {\emphline{1-8} {9} {10-15}{potencia.f95}}
\only<4> {\emphline{1-9} {10}{11-15}{potencia.f95}}
\only<5> {\emphline{1-10}{11}{12-15}{potencia.f95}}
\only<6> {\emphline{1-9} {10}{11-15}{potencia.f95}}
\only<7> {\emphline{1-10}{11}{12-15}{potencia.f95}}
\only<8> {\emphline{1-9} {10}{11-15}{potencia.f95}}
\only<9> {\emphline{1-10}{11}{12-15}{potencia.f95}}
\only<10>{\emphline{1-9} {10}{11-15}{potencia.f95}}
\only<11>{\emphline{1-13}{14}{15-15}{potencia.f95}}
\end{frame}
\end{document}
View diapo.tex
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
program potencia
implicit none
real :: base, resultado
integer :: exponente, i
 
read *, base
read *, exponente
 
resultado = 1
do i = 1, exponente
resultado = resultado * base
end do
 
print *, resultado
end program potencia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.