Last active
November 26, 2021 19:13
-
-
Save kuang-da/6b070179fed847f80395cdf26ad1eb48 to your computer and use it in GitHub Desktop.
[Notes about LaTeX] Examples and common code snipets of LaTeX #LaTeX
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% ---------Introduction ---------------- | |
% This snept is used to organize some small examples for LaTeX package listings. | |
% Iistings is a greate package for formating code in PDF files. | |
% https://ctan.org/pkg/listings?lang=en | |
% ------------------------------------- | |
\usepackage{listings} | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Code Style | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\lstset{ | |
numbers=left, | |
numberstyle=\small, | |
numbersep=8pt, | |
frame = single, | |
framexleftmargin=15pt, | |
breaklines=true, | |
columns=fullflexible | |
} | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Inline code | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
\lstinline$var i:integer;$ | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Code File | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
\lstinputlisting{my-code.py} | |
\lstinputlisting[language=Python]{my-code.py} | |
\lstinputlisting[language=R]{code/hw3-q2.R} | |
\lstinputlisting[language=Octave, | |
caption=Octave sample code | |
]{BitXorMatrix.m} | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Code snippet | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Set line number | |
\lstset{numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt} | |
\begin{lstlisting} | |
for i:=maxint to 0 do | |
begin | |
{ do nothing } | |
end; | |
Write(`Case insensitive '); | |
WritE(`Pascal keywords.'); | |
\end{lstlisting} | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Floating code snippet | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
\begin{lstlisting}[float,caption=A floating example,label=myLabel] | |
for i:=maxint to 0 do | |
begin | |
{ do nothing } | |
end; | |
Write(`Case insensitive'); | |
WritE(`Pascal keywords.'); | |
\end{lstlisting} | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Learn More | |
%%%%%%%%%%%%%%%%%%%%%%%%% | |
https://www.overleaf.com/learn/latex/code_listing | |
http://texdoc.net/texmf-dist/doc/latex/listings/listings.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\begin{figure}[H] | |
\centering | |
\includegraphics[width=0.7\linewidth]{fig/screenshot001} | |
\caption{Conditional Contingency Table} | |
\label{fig:screenshot001} | |
\end{figure} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage{physics} | |
\begin{document} | |
\[ | |
\dv{Q}{t} = \dv{s}{t} \quad | |
\dv[n]{Q}{t} = \dv[n]{s}{t} \quad | |
\pdv{Q}{t} = \pdv{s}{t} \quad | |
\pdv[n]{Q}{t} = \pdv[n]{s}{t} \quad | |
\pdv{Q}{x}{t} = \pdv{s}{x}{t} \quad | |
\] | |
\[ | |
\fdv{F}{g} | |
\] | |
\end{document} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$stackrel{?}{=}$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment