Skip to content

Instantly share code, notes, and snippets.

View vicapow's full-sized avatar

Victor vicapow

View GitHub Profile
@vicapow
vicapow / main.tex
Last active December 28, 2024 05:30
Table Editor UX experiments
\documentclass{article}
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{|l|c|}
\hline
Pittsburgh & 100 \\
\hline
@vicapow
vicapow / main.tex
Last active December 12, 2024 19:01
Example concentric layered diagram
\documentclass{article}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}
% Draw ovals first
\fill[red!50] (0, 0.8) ellipse (6cm and 3.8cm);
@vicapow
vicapow / main.tex
Last active December 18, 2024 04:14
Chapter title formatting
\documentclass{book} % Assuming a book class is appropriate for chapters
\usepackage{titlesec} % Required for title formatting
\titleformat{\chapter} % Corrected command
[display]
{\normalfont\bfseries\huge}
{Chapter \thechapter}
{0pt} % Corrected spacing option
{\vspace{2\baselineskip}}
@vicapow
vicapow / main.tex
Last active December 18, 2024 04:16
Avoid overlapping axis labels and show correct legend item using `forget plot` See a live version at: https://crixet.com/?gist=e6c41b3f283ffca6548cd923cd154969
% Original Tex question at:
% https://tex.stackexchange.com/questions/730485/difficulty-changing-legend-marker-and-resizing-in-pgfplots
\documentclass{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\pgfplotsset{compat=1.18}
\usepackage{pdflscape}
\begin{document}
@vicapow
vicapow / main.tex
Created November 10, 2024 22:41
Example of using tcolorbox in Latex / Ejemplo de uso de tcolorbox en LaTeX
\documentclass{article}
\usepackage{tcolorbox}
\newtcolorbox{shadedsection}[1][]{ % Custom box with options / Caja personalizada con opciones
colback=blue!20, % Background color of the box / Color de fondo de la caja
colframe=blue!50, % Border color of the box / Color del borde de la caja
boxrule=0pt, % Border thickness (0pt = no border) / Grosor del borde (0pt = sin borde)
width=\textwidth, % Box width, same as the text width / Ancho de la caja, igual al ancho del texto
sharp corners, % No rounded corners / Sin esquinas redondeadas
left=0pt, right=0pt, top=2pt, bottom=2pt, % Padding / Relleno
@vicapow
vicapow / main.tex
Last active November 3, 2024 20:19
Attempting to replicate the gradetable macro of the exam package in Latex
% In response to the stackexchange question: https://tex.stackexchange.com/questions/680066/customising-gradetable-to-group-multiple-choice-into-1-column-with-the-exam-cl
% You can compile and view the pdf version of this Latex document at: https://crixet.com/?gist=d433f7deda0eb630dad9b98bb3b281b9
\documentclass[addpoints]{exam}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{multicol}
\begin{document}
@vicapow
vicapow / main.tex
Last active November 3, 2024 06:27
% Original question on Reddit: https://www.reddit.com/r/LaTeX/comments/1gi75el/these_commands_arent_working_any_help/
% To view the source code or fork it, see: https://gist.github.com/vicapow/fd736f10b9382e924875f4e093a63d33
% Note, you may need to compile twice to ensure the refernces get updated completely.
\documentclass{article}
\usepackage{amsmath} % Required for split and align environments
(async function() {
async function fetchData(date) {
var date_split = date.split('-'),
year = date_split[0],
month = date_split[1],
day = date_split[2];
if (parseInt(day) < 10){
day = parseInt(day);
}
month = parseInt(month) - 1;
@vicapow
vicapow / main.cpp
Created June 29, 2020 17:35
C++ rvalue reference and move semantics
#include <iostream>
#include <vector>
using namespace std;
struct A {
int * ptr;
A() {
cout << "Constructor" << endl;
ptr = new int;
@vicapow
vicapow / remove-lodash-es.js
Created March 6, 2020 21:46
convert lodash-es back to lodash
export default function transformer(file, api) {
const j = api.jscodeshift;
const root = j(file.source);
let body;
root.find(j.Program).map(program => {
body = program.value.body;
});
const lodashImports = root